--- - name: Restart chrony service: name: "{{ item.name }}" state: restarted when: "{{ item.os == ansible_facts['distribution'] }}" loop: - os: Debian name: chrony - os: Archlinux name: chronyd - name: Restart journald service: name=systemd-journald state=restarted