2022-07-21 01:00:17 +02:00
|
|
|
[Unit]
|
|
|
|
Description=Nomad
|
|
|
|
Documentation=https://nomadproject.io/docs/
|
|
|
|
Wants=network-online.target
|
|
|
|
After=network-online.target
|
2023-07-03 12:00:08 +02:00
|
|
|
After=vault.service
|
|
|
|
After=consul.service
|
2023-07-08 16:00:11 +02:00
|
|
|
After=nomad-vault-agent.service
|
2022-07-29 15:00:16 +02:00
|
|
|
ConditionFileNotEmpty={{ nomad_root_dir }}/etc/nomad.hcl
|
2022-07-21 01:00:17 +02:00
|
|
|
|
2023-07-08 16:00:11 +02:00
|
|
|
# Nomad version {{ nomad_current_version }}
|
2022-07-21 01:00:17 +02:00
|
|
|
[Service]
|
2024-05-30 15:01:03 +02:00
|
|
|
Type=notify
|
2022-07-21 01:00:17 +02:00
|
|
|
EnvironmentFile=-{{ nomad_root_dir }}/etc/nomad.env
|
2023-07-08 16:00:11 +02:00
|
|
|
EnvironmentFile=-/run/nomad/vault.env
|
|
|
|
EnvironmentFile=-/run/nomad/consul.env
|
2022-09-04 18:00:17 +02:00
|
|
|
{% if nomad_conf.consul.ssl and nomad_conf.client.enabled %}
|
|
|
|
Environment=CONSUL_HTTP_SSL=true
|
|
|
|
Environment=CONSUL_HTTP_ADDR=localhost:{{ (consul_services is defined) | ternary(consul_services.https.port, '8501') }}
|
|
|
|
Environment=CONSUL_CACERT={{ nomad_conf.consul.ca_file }}
|
|
|
|
Environment=CONSUL_CLIENT_CERT={{ nomad_conf.consul.cert_file }}
|
|
|
|
Environment=CONSUL_CLIENT_KEY={{ nomad_conf.consul.key_file }}
|
|
|
|
{% endif %}
|
2022-07-21 01:00:17 +02:00
|
|
|
User={{ nomad_user }}
|
|
|
|
Group={{ nomad_user }}
|
2023-07-08 16:00:11 +02:00
|
|
|
ExecStart=/usr/local/bin/nomad agent -config {{ nomad_root_dir }}/etc
|
2022-07-21 01:00:17 +02:00
|
|
|
ExecReload=/bin/kill --signal HUP $MAINPID
|
|
|
|
Restart=on-failure
|
|
|
|
LimitNOFILE=65536
|
|
|
|
LimitNPROC=infinity
|
2022-08-01 11:00:15 +02:00
|
|
|
Restart=on-failure
|
2022-09-08 18:00:11 +02:00
|
|
|
RestartSec=5
|
|
|
|
StartLimitInterval=0
|
2022-07-21 01:00:17 +02:00
|
|
|
TasksMax=infinity
|
|
|
|
OOMScoreAdjust=-1000
|
2023-08-17 16:00:21 +02:00
|
|
|
{% if nomad_conf.client.enabled %}
|
|
|
|
# Give Nomad some time to drain the node
|
|
|
|
TimeoutStopSec=3600
|
|
|
|
{% endif %}
|
2022-07-21 01:00:17 +02:00
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|