cellinfo
/
ansible.apt
Archived
2
0
Fork 0

Manage `unattended-upgrades`.

This commit is contained in:
Jeremy Gardais 2017-08-18 11:10:36 +02:00
parent fa17ca5b94
commit 71fd085504
4 changed files with 18 additions and 2 deletions

View File

@ -11,3 +11,4 @@
* Ensure to never remove some packages pattern. * Ensure to never remove some packages pattern.
* Manage general, periodic and dpkg config files. * Manage general, periodic and dpkg config files.
* Purge default configuration files sets by others apps. * Purge default configuration files sets by others apps.
* Manage `unattended-upgrades`.

View File

@ -34,6 +34,7 @@ Manage APT repos, preferences and configuration for IPR's servers.
* **apt_old_pkg_list**: The list of totally useless packages for a production server [default [see below](#tools)]. * **apt_old_pkg_list**: The list of totally useless packages for a production server [default [see below](#tools)].
* **apt_old_pkg_state**: State of old packages [default: `absent`]. * **apt_old_pkg_state**: State of old packages [default: `absent`].
* **apt_old_pkg_manage**: If those old packages should be managed by the role [default: `true`]. * **apt_old_pkg_manage**: If those old packages should be managed by the role [default: `true`].
* **apt_unattended_upgrades**: If `unattended-upgrades` should be managed by the role [default: `yes`].
## Example Playbook ## Example Playbook
@ -71,6 +72,7 @@ Manage Debian's sources.list:
- Ensure to remove really useless packages from a default installation: - Ensure to remove really useless packages from a default installation:
* laptop-detect (if a server is a laptop…) * laptop-detect (if a server is a laptop…)
* tasksel (simple interface) * tasksel (simple interface)
- Manage `unattended-upgrades`.
## Development ## Development

View File

@ -1,6 +1,7 @@
--- ---
# defaults file for apt # defaults file for apt
# configuration
apt_conf_update_pkg_lists: 1 apt_conf_update_pkg_lists: 1
apt_conf_download_upgradeable_pkg: 1 apt_conf_download_upgradeable_pkg: 1
apt_conf_auto_clean_interval: 0 apt_conf_auto_clean_interval: 0
@ -11,14 +12,17 @@ apt_conf_purge_list:
- 70debconf - 70debconf
apt_conf_purge_manage: true apt_conf_purge_manage: true
# repositories
apt_src_list_manage: true apt_src_list_manage: true
apt_purge_src_list_file: true apt_purge_src_list_file: true
apt_stretch_manage: true apt_stretch_manage: true
# preferences
apt_default_pref_path: '/etc/apt/preferences.d/default.pref' apt_default_pref_path: '/etc/apt/preferences.d/default.pref'
apt_default_pref_tpl: 'etc/apt/preferences.d/default.pref.j2' apt_default_pref_tpl: 'etc/apt/preferences.d/default.pref.j2'
# packages
apt_tools_list: apt_tools_list:
- aptitude - aptitude
apt_tools_state: 'installed' apt_tools_state: 'installed'
@ -28,3 +32,6 @@ apt_old_pkg_list:
- tasksel - tasksel
apt_old_pkg_state: 'absent' apt_old_pkg_state: 'absent'
apt_old_pkg_manage: true apt_old_pkg_manage: true
# unattended-upgrades
apt_unattended_upgrades: yes

View File

@ -2,7 +2,7 @@
# tasks file for packages # tasks file for packages
# Packages # Packages
- name: Ensure useful tools packages - name: INSTALL useful tools packages
apt: apt:
name: '{{ item }}' name: '{{ item }}'
state: '{{ apt_tools_state }}' state: '{{ apt_tools_state }}'
@ -10,7 +10,13 @@
- '{{ apt_tools_list }}' - '{{ apt_tools_list }}'
when: apt_tools_manage when: apt_tools_manage
- name: Ensure to purge useless packages - name: INSTALL unattended-upgrades
apt:
pkg: "unattended-upgrades"
state: "{{ 'latest' if apt_unattended_upgrades else 'absent' }}"
when: apt_unattended_upgrades
- name: INSTALL purge useless packages
apt: apt:
name: '{{ item }}' name: '{{ item }}'
state: '{{ apt_old_pkg_state }}' state: '{{ apt_old_pkg_state }}'