aboutsummaryrefslogtreecommitdiffstats
path: root/roles/fedora/tasks/dnf.yml
blob: aa0207e49c8fccd6bfafbd6baac8fb069f222637 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
- name: Configure dnf.conf
  ini_file:
    path: '/etc/dnf/dnf.conf'
    no_extra_spaces: yes
    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: "{{ dnf_packages|dictsort(true)|selectattr(1,'equalto','absent')|map(attribute=0)|list }}"
    state: absent
  tags:
  - packages

- name: Upgrade all packages
  dnf:
    name: '*'
    state: latest
  tags:
  - upgrade
  - packages

- name: Install packages
  dnf:
    name: "{{ dnf_packages|dictsort(true)|selectattr(1,'equalto','present')|map(attribute=0)|list }}"
    state: present
  tags:
  - packages

- name: Configure dnf-makecache timer
  systemd:
    name: dnf-makecache.timer
    enabled: "{{ dnf_makecache|ternary('yes','no') }}"
    masked: no
    state: "{{ dnf_makecache|ternary('started','stopped') }}"
  when: not chroot
- name: '- when in chroot'
  command: "systemctl {{ dnf_makecache|ternary('enable','disable') }} dnf-makecache.timer"
  when: chroot|bool

# vim: set ts=2 sw=2 et: