--- - hosts: - yum - dnf - dnf5 tasks: - name: Install python3-dnf5 command: cmd: dnf5 -y install python3-libdnf5 creates: /usr/lib*/python3.*/site-packages/libdnf5 when: ansible_pkg_mgr == "dnf5" - name: Install Chrony ansible.builtin.yum: name=chrony state=latest - name: Copy config file ansible.builtin.copy: src=chrony.conf dest=/etc/chrony.conf mode=0644 owner=root group=root backup=yes - name: Restart Chrony with new config ansible.builtin.service: name=chronyd state=restarted - name: Start Chrony at boot ansible.builtin.service: name=chronyd enabled=yes