hcp-ansible/roles/nomad/templates/nomad.service.j2
Bertrand Lanson 2c9f538cef
All checks were successful
development / Check commit compliance (push) Successful in 6s
feat(roles): integrate nomad role to hashistack collection
2024-07-19 23:32:24 +02:00

34 lines
853 B
Django/Jinja

[Unit]
Description=Nomad
Documentation=https://developer.hashicorp.com/nomad/docs
Wants=network-online.target
After=network-online.target
ConditionFileNotEmpty={{ nomad_config_dir }}/nomad.json
{% if nomad_configuration.consul.address is defined %}
Wants=consul.service
After=consul.service
{% endif %}
[Service]
EnvironmentFile=-{{ nomad_config_dir }}/nomad.env
{% if not (nomad_configuration.client.enabled is defined and nomad_configuration.client.enabled) %}
User={{ nomad_user }}
Group={{ nomad_group }}
{% else %}
User=root
Group=root
{% endif %}
ExecStart={{ nomad_binary_path }} agent -config {{ nomad_config_dir }}/nomad.json
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
KillSignal=SIGINT
Restart=on-failure
LimitNOFILE=65536
LimitNPROC=infinity
RestartSec=2
TasksMax=infinity
OOMScoreAdjust=-1000
[Install]
WantedBy=multi-user.target