diff --git a/ansible/templates/nomad-base.hcl b/ansible/templates/nomad-base.hcl deleted file mode 100644 index 7107419..0000000 --- a/ansible/templates/nomad-base.hcl +++ /dev/null @@ -1,10 +0,0 @@ -datacenter = {{ nomad_datacenter_name }} -data_dir = "/opt/nomad" - -bind_addr = "0.0.0.0" - -advertise { - http = "{{ ansible_default_ipv4[address] }}" - rpc = "{{ ansible_default_ipv4[address] }}" - serf = "{{ ansible_default_ipv4[address] }}" -} diff --git a/ansible/templates/nomad-base.hcl.j2 b/ansible/templates/nomad-base.hcl.j2 new file mode 100644 index 0000000..8595771 --- /dev/null +++ b/ansible/templates/nomad-base.hcl.j2 @@ -0,0 +1,10 @@ +datacenter = "{{ nomad_datacenter_name }}" +data_dir = "/opt/nomad" + +bind_addr = "0.0.0.0" + +advertise { + http = "{{ ansible_host }}" + rpc = "{{ ansible_host }}" + serf = "{{ ansible_host }}" +} diff --git a/ansible/templates/nomad.service b/ansible/templates/nomad.service new file mode 100644 index 0000000..546ed94 --- /dev/null +++ b/ansible/templates/nomad.service @@ -0,0 +1,25 @@ +[Unit] +Wants=network-online.target +After=network-online.target + +Wants=consul.service +After=consul.service + +[Service] +User=root +Group=root + +ExecReload=/bin/kill -HUP $MAINPID +ExecStart=/usr/bin/nomad agent -config /etc/nomad.d +KillMode=process +KillSignal=SIGINT +LimitNOFILE=65536 +LimitNPROC=infinity +Restart=on-failure +RestartSec=2 + +TasksMax=infinity +OOMScoreAdjust=-1000 + +[Install] +WantedBy=multi-user.target \ No newline at end of file