From 078ddb2103fd610a75a0624746b5d0307ab69f3d Mon Sep 17 00:00:00 2001 From: Mark van Driel Date: Wed, 19 Jan 2022 11:39:01 +0100 Subject: [PATCH] Make it possible to remove default configuration (files) --- README.md | 3 +++ defaults/main.yml | 1 + tasks/main.yml | 10 ++++++++++ 3 files changed, 14 insertions(+) diff --git a/README.md b/README.md index 68061d4..668ea44 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ Manage packages and up(date|grade)s in Debian-like systems. * `apt_remove_purge`: [default: `false`]: Whether or not to purge * `apt_etc_apt_apt_conf`: [default: `[]`]: List of lines to be added to `/etc/apt/apt.conf` +* `apt_etc_apt_apt_conf_d_files_absent`: [default: `[]`]: List of files to be removed from `/etc/apt/apt.conf.d` ## Dependencies @@ -63,6 +64,8 @@ None Fix-Broken "true"; }; }; + apt_etc_apt_apt_conf_d_files_absent: + - 20auto-upgrades ``` #### License diff --git a/defaults/main.yml b/defaults/main.yml index 2b3371a..59273f1 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -44,3 +44,4 @@ apt_remove: [] apt_remove_purge: false apt_etc_apt_apt_conf: [] +apt_etc_apt_apt_conf_d_files_absent: [] diff --git a/tasks/main.yml b/tasks/main.yml index aedeb09..2fe7205 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -27,6 +27,16 @@ - apt - apt-configuration +- name: remove configuration files - /etc/apt/apt.conf.d/* + file: + path: "/etc/apt/apt.conf.d/{{ item }}" + state: absent + with_items: "{{ apt_etc_apt_apt_conf_d_files_absent }}" + tags: + - configuration + - apt + - apt-configuration + - name: ensure directory exists - /var/lib/apt/lists/ file: path: /var/lib/apt/lists/