diff options
author | Emil Renner Berthing <esmil@labitat.dk> | 2018-11-22 22:14:39 +0100 |
---|---|---|
committer | Emil Renner Berthing <esmil@labitat.dk> | 2018-11-22 22:14:39 +0100 |
commit | f0231d0d9454467ac0c1fc8e5a79a63204425851 (patch) | |
tree | 161ead8a343b092c5b59aa747d78cd12a903f3d5 /roles/debian/tasks | |
parent | 8bc773dd99c20b47a45dda791ea1f8d60df4a733 (diff) | |
download | labitat-ansible-f0231d0d9454467ac0c1fc8e5a79a63204425851.tar.gz labitat-ansible-f0231d0d9454467ac0c1fc8e5a79a63204425851.tar.xz labitat-ansible-f0231d0d9454467ac0c1fc8e5a79a63204425851.zip |
debian: apt: update and manage apt-preferences.d
Diffstat (limited to 'roles/debian/tasks')
-rw-r--r-- | roles/debian/tasks/apt.yml | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/roles/debian/tasks/apt.yml b/roles/debian/tasks/apt.yml index ff9a960..c9fb0f9 100644 --- a/roles/debian/tasks/apt.yml +++ b/roles/debian/tasks/apt.yml @@ -17,14 +17,30 @@ - name: Remove packages apt: - name: '{{ item }}' + name: "{{ apt_packages|dictsort(true)|selectattr(1,'equalto','absent')|map(attribute=0)|list }}" state: absent autoremove: yes purge: yes - with_items: "{{ apt_packages|dictsort(true)|selectattr(1,'equalto','absent')|map(attribute=0)|list }}" tags: - packages +- name: Create /etc/apt/preferences.d + template: + dest: '/etc/apt/preferences.d/{{ item.key }}' + src: apt-preferences.j2 + owner: root + group: root + mode: 0644 + with_dict: '{{ apt_preferences }}' + when: item.value + +- name: Remove /etc/apt/preferences.d + file: + path: '/etc/apt/preferences.d/{{ item.key }}' + state: absent + with_dict: '{{ apt_preferences }}' + when: not item.value + - name: Configure /etc/apt/sources.list template: dest: '/etc/apt/sources.list' @@ -59,9 +75,8 @@ - name: Install packages apt: - name: '{{ item }}' + name: "{{ apt_packages|dictsort(true)|selectattr(1,'equalto','present')|map(attribute=0)|list }}" state: present - with_items: "{{ apt_packages|dictsort(true)|selectattr(1,'equalto','present')|map(attribute=0)|list }}" tags: - packages |