diff options
author | Emil Renner Berthing <esmil@labitat.dk> | 2018-09-23 17:37:15 +0200 |
---|---|---|
committer | Emil Renner Berthing <esmil@labitat.dk> | 2018-09-23 17:42:37 +0200 |
commit | 58168b200c891b2f94d2ec8281093348f3e26943 (patch) | |
tree | b43363a05d39e736a7b8339636d16dafaed78d53 /roles/fedora | |
parent | 09763679131a9c4bfd8d3b891f589b44d42a3657 (diff) | |
download | labitat-ansible-58168b200c891b2f94d2ec8281093348f3e26943.tar.gz labitat-ansible-58168b200c891b2f94d2ec8281093348f3e26943.tar.xz labitat-ansible-58168b200c891b2f94d2ec8281093348f3e26943.zip |
fedora: dnf: make even more attribute driven
Diffstat (limited to 'roles/fedora')
-rw-r--r-- | roles/fedora/tasks/dnf.yml | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/roles/fedora/tasks/dnf.yml b/roles/fedora/tasks/dnf.yml index a0c0db9..cc28e97 100644 --- a/roles/fedora/tasks/dnf.yml +++ b/roles/fedora/tasks/dnf.yml @@ -1,46 +1,38 @@ --- - name: Configure dnf.conf ini_file: - path: /etc/dnf/dnf.conf + path: '/etc/dnf/dnf.conf' no_extra_spaces: yes - section: '{{ item.section }}' - option: '{{ item.option }}' - value: '{{ item.value }}' - with_items: - - section: main - option: 'install_weak_deps' - value: 'False' - - section: main - option: 'best' - value: 'True' - - section: main - option: 'deltarpm' - value: 'False' - -- name: Update all packages - dnf: - name: '*' - state: latest - tags: - - update - - packages + create: no + section: "{{ item.key.split('.',1)[0] }}" + option: "{{ item.key.split('.',1)[1] }}" + value: "{{ item.value|ternary(item.value,omit) }}" + state: "{{ item.value|ternary('present','absent') }}" + with_dict: '{{ dnf_conf }}' - name: Remove packages dnf: name: '{{ item }}' state: absent - with_items: '{{ packages.remove }}' - when: "'remove' in packages" + with_items: "{{ dnf_packages|dictsort(true)|selectattr(1,'equalto','absent')|map(attribute=0)|list }}" + tags: - - packages + - packages + +- name: Update all packages + dnf: + name: '*' + state: latest + tags: + - update + - packages - name: Install packages dnf: name: '{{ item }}' - state: latest - with_items: '{{ packages.install }}' - when: "'install' in packages" + state: present + with_items: "{{ dnf_packages|dictsort(true)|selectattr(1,'equalto','present')|map(attribute=0)|list }}" tags: - - packages + - packages # vim: set ts=2 sw=2 et: |