- name: Restart dnsmasq service: name: dnsmasq enabled: true state: restarted when: ansible_facts.services['dnsmasq.service'] is defined