aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.ansible/roles/nomad/templates/client.hcl.j2
blob: f82f38a4e4431a33875b6d8bff54d85066433d37 (plain)
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
client {
    enabled = {{ nomad_node_client | bool | lower }}

    node_class = "{{ nomad_node_class }}"
    no_host_uuid = {{ nomad_no_host_uuid | bool | lower }}

{% if nomad_use_consul == False %}
    {% if nomad_servers -%}
        servers = [ {% for ip_port in nomad_servers -%} "{{ ip_port }}" {% if not loop.last %},{% endif %}{%- endfor -%} ]
    {% endif -%}
{% endif %}

    {% if nomad_network_interface is defined -%}
    network_interface = "{{ nomad_network_interface }}"
    {% endif -%}
    {% if nomad_network_speed is defined -%}
    network_speed = "{{ nomad_network_speed }}"
    {% endif -%}
    {% if nomad_cpu_total_compute is defined -%}
    cpu_total_compute = {{ nomad_cpu_total_compute }}
    {% endif -%}

    reserved {
        cpu = {{ nomad_reserved['cpu'] }}
        memory = {{ nomad_reserved['memory'] }}
        disk = {{ nomad_reserved['disk'] }}
    }

    {% for nomad_host_volume in nomad_volumes -%}
    host_volume "{{ nomad_host_volume.name }}" {
        path = "{{ nomad_host_volume.path }}"
        read_only = {{ nomad_host_volume.read_only | bool | lower }}
    }
    {% endfor %}

    {% if nomad_chroot_env != False -%}
    chroot_env = {
    {% for key, value in nomad_chroot_env.items() %}
    "{{ key }}" = "{{ value }}"
    {% endfor -%}
    }
    {% endif %}

    {% if nomad_options -%}
    options = {
    {% for key, value in nomad_options.items() %}
    "{{ key }}" = "{{ value }}"
    {% endfor -%}
    }
    {% endif %}

    {% if nomad_meta -%}
    meta = {
    {% for key, value in nomad_meta.items() %}
    "{{ key }}" = "{{ value }}"
    {% endfor -%}
    }
    {% endif %}

}