---
- name: Update Nomad config to run as a client
  hosts: localhost
  gather_facts: no
  become: yes
  tasks:
    - name: Create new nomad.hcl
      copy:
        dest: /etc/nomad.d/nomad.hcl
        content: |
          datacenter = "dc1"
          data_dir = "/opt/nomad/data"
          log_level = "INFO"

          bind_addr = "100.116.158.95"

          server {
            enabled = false
          }

          client {
            enabled = true
            servers = ["100.81.26.3:4647", "100.103.147.94:4647", "100.90.159.68:4647"]
          }

          plugin "podman" {
            config {
              socket_path = "unix:///run/podman/podman.sock"
              volumes {
                enabled = true
              }
            }
          }

          consul {
            address = "100.116.158.95:8500"
          }