-
Notifications
You must be signed in to change notification settings - Fork 19
/
nomad.hcl.j2
63 lines (57 loc) · 1.53 KB
/
nomad.hcl.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
datacenter = "{{ nomad_datacenter }}"
data_dir = "{{ nomad_data_dir }}"
bind_addr = "0.0.0.0"
advertise {
http = "{{ network_interface_ipv4 }}:4646"
rpc = "{{ network_interface_ipv4 }}:4647"
serf = "{{ network_interface_ipv4 }}:4648"
}
{% if nomad_is_client %}
{# loopback interface is `lo` on Linux, but `lo0` on macOS/BSD #}
client {
enabled = true
network_interface = "{{ network_interface | default(ansible_interfaces | select('match', '^lo\d?') | first) }}"
}
{% endif %}
consul {
address = "127.0.0.1:8500"
# If the configuration is separated for server and client nodes, the tag
# "controlplane" should only be used on the server nodes.
tags = ["controlplane"]
}
{% if nomad_is_server %}
server {
enabled = true
# MUST be 16 bytes, Base64-encoded
encrypt = "{{ lookup('password', '/tmp/nomadhash length=16') | b64encode }}"
bootstrap_expect = {{ groups['consul_nomad'] | length }}
server_join {
retry_join = {{ consul_nomad_ips | to_json }}
retry_max = 3
retry_interval = "15s"
}
}
{% endif %}
telemetry {
collection_interval = "1s"
disable_hostname = true
prometheus_metrics = true
publish_allocation_metrics = true
publish_node_metrics = true
}
{% if vault_nomad_token is defined %}
{% if nomad_is_server %}
vault {
enabled = true
address = "http://active.vault.service.consul:8200"
task_token_ttl = "1h"
create_from_role = "nomad-cluster"
token = "{{ vault_nomad_token }}"
}
{% else %}
vault {
enabled = true
address = "http://active.vault.service.consul:8200"
}
{% endif %}
{% endif %}