---
- name: restart consul
  action: service name=consul state=restarted enabled=yes

- name: reload consul config
  sudo: yes
  command: pkill -1 consul

- name: reload systemd
  sudo: yes
  command: systemctl daemon-reload

- name: restart dnsmasq
  service: name=dnsmasq state=restarted enabled=yes

---
- name: restart consul
  action: service name=consul state={{ consul_service_state }} enabled=yes

- name: reload consul config
  sudo: yes
  command: pkill -1 consul
  when: consul_service_state is not  "stopped"

- name: reload systemd
  sudo: yes
  command: systemctl daemon-reload

- name: restart dnsmasq
  service: name=dnsmasq state=restarted enabled=yes

Allow consul service state to be overridden
Allow consul service state to be overridden
