---
- name: Install packages
  action: "{{ ansible_pkg_mgr }} state=installed name={{ item }}"
  with_items: 
    - dnf-automatic
  tags: package_install
  notify: restart dnf-automatic

- lineinfile: dest=/etc/dnf/dnf.conf
              regexp="^ip_resolve="
              line="ip_resolve=4"
  sudo: yes
  notify: restart dnf-automatic

- lineinfile: 
      dest: /etc/dnf/automatic.conf
      regexp: "{{ item.regexp }}"
      line: "{{ item.line }}"
  with_items:
    - { regexp: '^download_updates', line: 'download_updates = yes' }
    - { regexp: '^apply_updates', line: 'apply_updates = yes' }
    - { regexp: '^upgrade_type', line: 'upgrade_type = default' }
  sudo: yes
  notify: restart dnf-automatic

- service: name=dnf-automatic.timer enabled=yes
  sudo: yes

---
- name: Install packages
  action: "{{ ansible_pkg_mgr }} state=installed name={{ item }}"
  with_items: 
    - dnf-automatic
  tags: package_install
  notify: restart dnf-automatic

- lineinfile: dest=/etc/dnf/dnf.conf
              regexp="^ip_resolve="
              line="ip_resolve=4"
  sudo: yes
  notify: restart dnf-automatic

- lineinfile: 
      dest: /etc/dnf/automatic.conf
      regexp: "{{ item.regexp }}"
      line: "{{ item.line }}"
  with_items:
    - { regexp: '^download_updates', line: 'download_updates = yes' }
    - { regexp: '^apply_updates', line: 'apply_updates = yes' }
    - { regexp: '^upgrade_type', line: 'upgrade_type = default' }
  sudo: yes
  notify: restart dnf-automatic

- name: dnf-automatic.timer
  service: name=dnf-automatic.timer enabled=yes
  sudo: yes

Add name for enabling dnf-automatic.
Add name for enabling dnf-automatic.
