--- - name: "Install ntp" apt: name: ntp state: present - name: "Configure ntp" copy: src: ntp.conf dest: /etc/ntp.conf owner: root group: root mode: "644" # notify is going to invoke the "Restart ntp" handler defined in # the roles/ntp/handlers/main.yml file. Basically it says that # you want to restart the ntp service every time the configuratio # changes notify: "Restart ntp" # Here you say that you want the NTP service to be restarted as well # as enabled on boot. - name: "ntp service" service: name: ntp state: restarted enabled: true