diff --git a/defaults/main.yml b/defaults/main.yml index e56d4c1..edf8405 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -10,3 +10,14 @@ nomad_vault_token_ttl: "1h" nomad_vault_namespace: "" nomad_vault_role: "nomad-cluster" nomad_vault_token: "" +nomad_host_volumes: + [] + # - name: + # path: + # read_only: +nomad_host_networks: + [] + # - name: + # cidr: + # interface: + # reserved_ports: diff --git a/templates/config.hcl.j2 b/templates/config.hcl.j2 index 043abe0..d6788c3 100644 --- a/templates/config.hcl.j2 +++ b/templates/config.hcl.j2 @@ -9,6 +9,25 @@ enabled = {{ nomad_server |lower }} client { enabled = true +{% 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 %} } plugin "raw_exec" {