Infra: Cleanup Nomad configs
[csit.git] / fdio.infra.ansible / roles / nomad / templates / client.hcl.j2
1 client {
2     enabled = {{ nomad_node_client | bool | lower }}
3
4     node_class = "{{ nomad_node_class }}"
5     no_host_uuid = {{ nomad_no_host_uuid | bool | lower }}
6
7 {% if nomad_use_consul == False %}
8     {% if nomad_servers -%}
9         servers = [ {% for ip_port in nomad_servers -%} "{{ ip_port }}" {% if not loop.last %},{% endif %}{%- endfor -%} ]
10     {% endif -%}
11 {% endif %}
12
13     {% if nomad_network_interface is defined -%}
14     network_interface = "{{ nomad_network_interface }}"
15     {% endif -%}
16     {% if nomad_network_speed is defined -%}
17     network_speed = "{{ nomad_network_speed }}"
18     {% endif -%}
19     {% if nomad_cpu_total_compute is defined -%}
20     cpu_total_compute = {{ nomad_cpu_total_compute }}
21     {% endif -%}
22
23     reserved {
24         cpu = {{ nomad_reserved['cpu'] }}
25         memory = {{ nomad_reserved['memory'] }}
26         disk = {{ nomad_reserved['disk'] }}
27     }
28
29     {% for nomad_host_volume in nomad_volumes -%}
30     host_volume "{{ nomad_host_volume.name }}" {
31         path = "{{ nomad_host_volume.path }}"
32         read_only = {{ nomad_host_volume.read_only | bool | lower }}
33     }
34     {% endfor %}
35
36     {% if nomad_chroot_env != False -%}
37     chroot_env = {
38     {% for key, value in nomad_chroot_env.items() %}
39     "{{ key }}" = "{{ value }}"
40     {% endfor -%}
41     }
42     {% endif %}
43
44     {% if nomad_options -%}
45     options = {
46     {% for key, value in nomad_options.items() %}
47     "{{ key }}" = "{{ value }}"
48     {% endfor -%}
49     }
50     {% endif %}
51
52     {% if nomad_meta -%}
53     meta = {
54     {% for key, value in nomad_meta.items() %}
55     "{{ key }}" = "{{ value }}"
56     {% endfor -%}
57     }
58     {% endif %}
59
60 }