diff --git a/defaults/main.yml b/defaults/main.yml index 561bab7..ed63550 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -27,6 +27,8 @@ apt_dependencies: - aptitude - python3-apt - python3-pycurl +# do cache update +apt_update: true # sets the amount of time the cache is valid apt_cache_valid_time: 3600 # upgrade system: safe | full | dist @@ -44,7 +46,10 @@ apt_autoclean: yes # .deb packages to install. apt_deb_packages: [] +# manage general and periodic entries via template +apt_general_periodic: true # https://people.debian.org/~hmh/invokerc.d-policyrc.d-specification.txt +# skip config if less than 0 (-1=disable) apt_policy: 101 # whether or not suggested packages should be installed. apt_install_suggests: no diff --git a/tasks/config.yml b/tasks/config.yml index bbbd2e4..b13b6cc 100644 --- a/tasks/config.yml +++ b/tasks/config.yml @@ -7,6 +7,7 @@ owner: "root" group: "root" mode: "0644" + when: apt_general_periodic | bool with_items: - "etc/apt/apt.conf.d/10general" - "etc/apt/apt.conf.d/10periodic" @@ -68,3 +69,4 @@ content: "exit {{ apt_policy }}" dest: /usr/sbin/policy-rc.d mode: "0755" + when: apt_policy | int >= 0 diff --git a/tasks/update.yml b/tasks/update.yml index 01e4663..660f96b 100644 --- a/tasks/update.yml +++ b/tasks/update.yml @@ -2,5 +2,5 @@ - name: Updating cache apt: - update_cache: yes + update_cache: "{{ apt_update | bool }}" cache_valid_time: "{{ apt_cache_valid_time }}" diff --git a/tasks/upgrade.yml b/tasks/upgrade.yml index 06589bc..4a882c4 100644 --- a/tasks/upgrade.yml +++ b/tasks/upgrade.yml @@ -3,6 +3,6 @@ - name: Upgrading system apt: upgrade: "{{ apt_upgrade }}" - update_cache: yes + update_cache: "{{ apt_update | bool }}" autoremove: "{{ apt_autoremove }}" when: (apt_upgrade == "safe") or (apt_upgrade == "full") or (apt_upgrade == "dist")