---

- name: Start and enable nomad service
  service: name=nomad state=started enabled=True
  register: nomad_service_started
  tags: nomad

- name: Handle consul-template-nomad service
  service:
    name: consul-template-nomad
    state: stopped
    enabled: False
  when: nomad_ct_service.stat.exists
  tags: nomad

- name: Handle iptables-nomad-cleanup service
  service:
    name: iptables-nomad-cleanup
    enabled: "{{ (nomad_conf.client.enabled and iptables_manage | default(True)) | ternary(True, False) }}"
  tags: nomad

- name: Handle podman service
  systemd:
    name: podman.socket
    state: started
    enabled: True
  when:
    - nomad_conf.client.enabled
    - nomad_conf.client.task_drivers.podman.enabled
  tags: nomad


