hcp-ansible/roles/hashicorp_nomad/templates/nomad.service.j2

33 lines
891 B
Django/Jinja

[Unit]
Description=Nomad
Documentation=https://developer.hashicorp.com/nomad/docs
Wants=network-online.target
After=network-online.target
ConditionFileNotEmpty={{ hashi_nomad_config_dir }}/nomad.json
{% if hashi_nomad_configuration.consul.address is defined %}
Wants=consul.service
After=consul.service
{% endif %}
[Service]
EnvironmentFile=-{{ hashi_nomad_config_dir }}/nomad.env
{% if not (hashi_nomad_configuration.client.enabled is defined and hashi_nomad_configuration.client.enabled) %}
User={{ hashi_nomad_user }}
Group={{ hashi_nomad_group }}
{% else %}
User=root
Group=root
{% endif %}
ExecStart=/usr/bin/nomad agent -config {{ hashi_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