--- - hosts: centos8 become: true vars: sudoers: ansible config_file: /etc/chrony.conf # chronyd client config-options chrony_pool: "server time.dmz.nausch.org iburst" chrony_stratumweight: "stratumweight 0" chrony_makestep: "makestep 10 3" tasks: - name: Install chrony ntp Deamon dnf: #https://docs.ansible.com/ansible/latest/modules/dnf_module.html name: chrony state: latest - name: Check if /etc/chrony.orig does exists stat: #https://docs.ansible.com/ansible/latest/modules/stat_module.html path: /etc/chrony.conf.orig register: stat_result - name: Make a copy of /etc/chrony.conf as /etc/chrony.conf.orig copy: #https://docs.ansible.com/ansible/latest/modules/copy_module.html remote_src: yes src: /etc/chrony.conf dest: /etc/chrony.conf.orig when: stat_result.stat.exists == False - name: Copy template config-file in place template: #https://docs.ansible.com/ansible/latest/modules/template_module.html src: templates/CentOS8/chrony-client.conf.j2 dest: "{{ config_file }}" - name: Make sure Chrony is started up service: #https://docs.ansible.com/ansible/latest/modules/service_module.html name: chronyd state: started enabled: yes ...