Преглед на файлове

Merge pull request #9 from daschatten/master

Add state for unattended upgrades.
tags/v0.7.0
Nitin Madhok преди 9 години
родител
ревизия
8742db0a8a
променени са 4 файла, в които са добавени 91 реда и са изтрити 0 реда
  1. +1
    -0
      .gitignore
  2. +8
    -0
      apt/map.jinja
  3. +60
    -0
      apt/unattended.sls
  4. +22
    -0
      pillar.example

+ 1
- 0
.gitignore Целия файл

@@ -0,0 +1 @@
*.swp

+ 8
- 0
apt/map.jinja Целия файл

@@ -0,0 +1,8 @@
{% set map = salt['grains.filter_by']({
'Debian': {
'pkgs': ['unattended-upgrades'],
'confd_dir': '/etc/apt/apt.conf.d',
'unattended_config': '50unattended-upgrades',
'periodic_config': '02periodic',
},
}, grain='os', merge=salt['pillar.get']('apt:lookup')) %}

+ 60
- 0
apt/unattended.sls Целия файл

@@ -0,0 +1,60 @@
# This is the main state file for configuring unattended upgrades with apt

{% from "apt/map.jinja" import map with context %}

apt_unattended_pakgs::
pkg.installed:
- pkgs:
{% for pkg in map.pkgs %}
- {{ pkg }}
{% endfor %}

{% set origins_pattern = salt['pillar.get']('apt:unattended:origings_pattern', ['origin=Debian,archive=stable,label=Debian-Security']) %}
{% set package_blacklist = salt['pillar.get']('apt:unattended:package_blacklist', {}) %}
{% set auto_fix_interrupted_dpkg = salt['pillar.get']('apt:unattended:auto_fix_interrupted_dpkg', 'true') %}
{% set minimal_steps = salt['pillar.get']('apt:unattended:minimal_steps', 'false') %}
{% set install_on_shutdown = salt['pillar.get']('apt:unattended:install_on_shutdown', 'false') %}
{% set mail = salt['pillar.get']('apt:unattended:mail', 'root') %}
{% set mail_only_on_error = salt['pillar.get']('apt:unattended:mail_only_on_error', 'false') %}
{% set remove_unused_dependencies = salt['pillar.get']('apt:unattended:remove_unused_dependencies', 'true') %}
{% set automatic_reboot = salt['pillar.get']('apt:unattended:automatic_reboot', 'false') %}
{% set dl_limit = salt['pillar.get']('apt:unattended:dl_limit', '0') %}

{{ map.confd_dir }}/{{ map.unattended_config }}:
file.managed:
- contents: |
Unattended-Upgrade::Origins-Pattern {
{%- for pattern in origins_pattern %}
"{{ pattern }}";
{%- endfor %}
};
Unattended-Upgrade::Package-Blacklist {
{%- for package in package_blacklist %}
"{{ package }}";
{%- endfor %}
};
Unattended-Upgrade::AutoFixInterruptedDpkg "{{ auto_fix_interrupted_dpkg }}";
Unattended-Upgrade::MinimalSteps "{{ minimal_steps }}";
Unattended-Upgrade::InstallOnShutdown "{{ install_on_shutdown }}";
Unattended-Upgrade::Mail "{{ mail }}";
Unattended-Upgrade::MailOnlyOnError "{{ mail_only_on_error }}";
Unattended-Upgrade::Remove-Unused-Dependencies "{{ remove_unused_dependencies }}";
Unattended-Upgrade::Automatic-Reboot "{{ automatic_reboot }}";
Acquire::http::Dl-Limit "{{ dl_limit }}";

{% set enabled = salt['pillar.get']('apt:unattended:enabled', '1') %}
{% set update_package_lists = salt['pillar.get']('apt:unattended:update_package_lists', '1') %}
{% set download_upgradeable_packages = salt['pillar.get']('apt:unattended:download_upgradeable_packages', '1') %}
{% set unattended_upgrade = salt['pillar.get']('apt:unattended:unattended_upgrade', '1') %}
{% set auto_clean_interval = salt['pillar.get']('apt:unattended:auto_clean_interval', '7') %}
{% set verbose = salt['pillar.get']('apt:unattended:verbose', '2') %}

{{ map.confd_dir }}/{{ map.periodic_config }}:
file.managed:
- contents: |
APT::Periodic::Enable "{{ enabled }}";
APT::Periodic::Update-Package-Lists "{{ update_package_lists }}";
APT::Periodic::Download-Upgradeable-Packages "{{ download_upgradeable_packages }}";
APT::Periodic::Unattended-Upgrade "{{ unattended_upgrade }}";
APT::Periodic::AutocleanInterval "{{ auto_clean_interval }}";
APT::Periodic::Verbose "{{ verbose }}";

+ 22
- 0
pillar.example Целия файл

@@ -0,0 +1,22 @@
apt:
unattended:
origins_pattern:
- origin1
- origin2
package_blacklist:
- package1
- package2
auto_fix_interrupted_dpkg: true
minimal_steps: false
install_on_shutdown: false
mail: root
mail_only_on_error: false
remove_unused_dependencies: true
automatic_reboot: false
dl_limit: 0
enabled: 1
update_package_lists: 1
download_upgradeable_packages: 1
unattended_upgrade: 1
auto_clean_interval: 7
verbose: 2

Loading…
Отказ
Запис