ansible-nomad/templates/config.hcl.j2

83 lines
1.9 KiB
Plaintext
Raw Normal View History

2022-03-13 15:03:33 +00:00
data_dir = "{{ nomad_data_dir}}"
bind_addr = "{{ nomad_bind_addr }}"
datacenter = "{{ nomad_datacenter }}"
server {
2022-04-03 18:41:19 +00:00
enabled = {{ nomad_server |lower }}
2022-03-13 15:03:33 +00:00
bootstrap_expect = {{ nomad_bootstrap_expect }}
}
client {
enabled = true
2022-04-09 07:43:51 +00:00
{% for nomad_host_volume in nomad_host_volumes %}
host_volume "{{ nomad_host_volume['name'] }}" {
path = "{{ nomad_host_volume['path'] }}"
read_only = {{ nomad_host_volume['read_only'] | bool | lower }}
}
{% endfor %}
{% for nomad_host_network in nomad_host_networks %}
host_network "{{ nomad_host_network['name'] }}" {
{% if 'cidr' in nomad_host_network %}
cidr = "{{ nomad_host_network['cidr'] | default}}"
{% else %}
interface = "{{ nomad_host_network['interface'] }}"
{% endif %}
{% if "reserved_ports" in nomad_host_network %}
reserved_ports = "{{ nomad_host_network['reserved_ports'] }}"
{% endif %}
}
{% endfor %}
2022-03-13 15:03:33 +00:00
}
plugin "raw_exec" {
config {
enabled = true
}
}
2022-04-03 18:42:01 +00:00
plugin "docker"{
config{
volumes {
enabled = true
selinuxlabel = "z"
}
2022-11-27 07:41:53 +00:00
{%if 'nomad_docker_allow_caps' %}
allow_caps = [ "{{nomad_docker_default_caps|join('","')}}","{{nomad_docker_allow_caps|join('","')}}"]
{% endif %}
2022-05-10 06:28:04 +00:00
allow_privileged = {{ nomad_allow_privileged|lower }}
2022-04-03 18:42:01 +00:00
}
}
2022-11-13 13:55:51 +00:00
{% if 'nomad_plugins_podman' %}
plugin "nomad-driver-podman" {
config {
volumes {
enabled = true
}
}
}
{% endif %}
2022-03-13 15:03:33 +00:00
consul {
address = "127.0.0.1:8500"
}
2022-03-22 17:38:02 +00:00
2022-05-10 12:22:26 +00:00
telemetry {
collection_interval = "5s",
publish_allocation_metrics = true,
publish_node_metrics = true,
prometheus_metrics = true
}
2022-03-22 17:38:02 +00:00
{% if nomad_vault_enabled %}
vault {
enabled = true
2022-03-26 10:39:57 +00:00
address = "{{ nomad_vault_address}}"
create_from_role = "{{ nomad_vault_role }}"
2022-04-03 18:41:19 +00:00
{% if nomad_server %}
2022-03-26 10:39:57 +00:00
token = "{{ nomad_vault_token }}"
namespace = "{{ nomad_vault_namespace}}"
task_token_ttl = "{{ nomad_vault_token_ttl }}"
2022-04-03 18:41:19 +00:00
{% endif %}
2022-03-22 17:38:02 +00:00
}
{% endif %}