diff --git a/CHANGELOG.md b/CHANGELOG.md index 94cd27d..6967d59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,3 +8,4 @@ * Manage default preferences file. * Ensure to install some additionnals tools (aptitude,…). * Ensure to remove really useless packages (laptop-detect, tasksel,…). +* Manage periodic config file. diff --git a/README.md b/README.md index a04add2..719e6d4 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ 2. [Role Variables](#role-variables) 3. [Example Playbook](#example-playbook) 4. [Configuration](#configuration) + * [APT Configuration](#apt-configuration) * [Sources List](#sources-list) * [Preferences](#preferences) * [Tools](#tools) @@ -17,6 +18,9 @@ Manage APT repos, preferences and configuration for IPR's servers. ## Role Variables +* **apt_conf_update_pkg_lists** : Period of automatic repositories update in days [default : `1`]. +* **apt_conf_download_upgradeable_pkg** : Period of automatic download of upgradeable packages in days [default : `1`]. +* **apt_conf_auto_clean_interval** : Period of automatic clean of no longer available packages [default : `0`]. * **apt_src_list_manage** : If apt sources list files should be managed [default : `true`]. * **apt_purge_src_list_file** : If the default sources.file must be absent [default : `true`]. * **apt_stretch_manage** : If Stretch configuration should be managed [default : `true`]. @@ -41,8 +45,10 @@ Manage APT repos, preferences and configuration for IPR's servers. ## Configuration -### Sources List +### APT Configuration +- Set periodic actions. +### Sources List Manage Debian's sources.list : * Remove the default `/etc/apt/sources.list` file. * Add Stretch repositories. diff --git a/defaults/main.yml b/defaults/main.yml index fd631b7..0f08282 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,10 @@ --- # defaults file for apt +apt_conf_update_pkg_lists: 1 +apt_conf_download_upgradeable_pkg: 1 +apt_conf_auto_clean_interval: 0 + apt_src_list_manage: true apt_purge_src_list_file: true diff --git a/tasks/config.yml b/tasks/config.yml new file mode 100644 index 0000000..ee7e780 --- /dev/null +++ b/tasks/config.yml @@ -0,0 +1,12 @@ +--- +# tasks file for config + +- name: CONFIG APT + template: + src: "{{ item }}.j2" + dest: "/{{ item }}" + owner: root + group: root + mode: 0644 + with_items: + - "etc/apt/apt.conf.d/10periodic" diff --git a/tasks/main.yml b/tasks/main.yml index ccc86f8..46fec14 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,6 +1,13 @@ --- # tasks file for apt +- include: config.yml + tags: + - system + - apt + - config + - apt-config + - include: preferences.yml tags: - system diff --git a/templates/etc/apt/apt.conf.d/10periodic.j2 b/templates/etc/apt/apt.conf.d/10periodic.j2 new file mode 100644 index 0000000..a8ca313 --- /dev/null +++ b/templates/etc/apt/apt.conf.d/10periodic.j2 @@ -0,0 +1,10 @@ +# {{ ansible_managed }} + +# Do "apt-get update" automatically every n-days (0=disable) +APT::Periodic::Update-Package-Lists "{{ apt_conf_update_pkg_lists }}"; + +# Do "apt-get upgrade --download-only" every n-days (0=disable) +APT::Periodic::Download-Upgradeable-Packages "{{ apt_conf_download_upgradeable_pkg }}"; + +# Do "apt-get autoclean" every n-days (0=disable) +APT::Periodic::AutocleanInterval "{{ apt_conf_auto_clean_interval }}";