---
- name: Change DNF Automatic
  ansible.builtin.ini_file:
    path: /etc/dnf/automatic.conf
    section: "{{ item.section }}"
    option: "{{ item.option }}"
    value: "{{ item.value }}"
    no_extra_spaces: true
    backup: false
  loop:
    - { section: commands, option: apply_updates, value: "yes" }
    - { section: commands, option: upgrade_type, value: "default" }
    - { section: commands, option: download_updates, value: "yes" }
    - { section: commands, option: random_sleep, value: "300" }
    - { section: commands, option: reboot, value: "when-needed" }

- name: Enable DNF Timer
  ansible.builtin.systemd:
    name: dnf-automatic.timer
    state: started

