ansible-hashistack/roles/nomad/templates/nomad.hcl.j2

68 lines
1.4 KiB
Plaintext
Raw Normal View History

2023-09-18 17:03:08 +02:00
datacenter = "{{ nomad_datacenter }}"
2023-10-06 12:05:33 +02:00
name = "{{ vm_name }}"
2023-09-18 17:03:08 +02:00
data_dir = "{{ nomad_data_dir }}"
2023-10-06 12:05:33 +02:00
bind_addr = "0.0.0.0"
2023-10-06 12:05:33 +02:00
advertise {
http = "{{ vm_ip }}"
rpc = "{{ vm_ip }}"
serf = "{{ vm_ip }}"
}
2023-09-18 17:03:08 +02:00
{% if 'admin' in group_names %}
server {
enabled = true
2023-10-06 12:05:33 +02:00
bootstrap_expect = 3
# uncoment retry_join if bootstrap_expect > 1
2023-10-06 12:05:33 +02:00
retry_join = [{% for host in groups['admin'] %}"{{ hostvars[host]['vm_ip'] }}"{% if not loop.last %},{% endif %}{% endfor %}]
2023-09-18 17:03:08 +02:00
}
{% endif %}
{% if 'client' in group_names %}
2023-09-18 17:03:08 +02:00
client {
enabled = true
servers = [{% for host in groups['admin'] %}"{{ hostvars[host]['vm_ip'] }}"{% if not loop.last %},{% endif %}{% endfor %}]
2023-09-18 17:03:08 +02:00
host_network "public" {
cidr = "{{ network_cidr }}"
}
}
{% endif %}
2023-09-18 17:03:08 +02:00
consul {
address = "{{ vm_ip}}:8500"
}
2023-09-18 17:03:08 +02:00
plugin "docker" {
config {
volumes {
enabled = true
selinuxlabel = "z"
}
extra_labels = ["job_name", "job_id", "task_group_name", "task_name", "namespace", "node_name", "node_id"]
gc {
image = true
image_delay = "3m"
container = true
dangling_containers {
enabled = true
dry_run = false
period = "5m"
creation_grace = "5m"
}
}
allow_privileged = true
}
}
2023-09-18 17:03:08 +02:00
telemetry {
collection_interval = "1s"
disable_hostname = true
prometheus_metrics = true
publish_allocation_metrics = true
publish_node_metrics = true
}