Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ nomad_region: global
nomad_log_level: INFO
nomad_syslog_enable: true
nomad_iface: "{{ lookup('env', 'NOMAD_IFACE') | default(ansible_default_ipv4.interface, true) }}"
nomad_iface_http: "{{ lookup('env', 'NOMAD_IFACE') | default(ansible_default_ipv4.interface, true) }}"
nomad_iface_rpc: "{{ lookup('env', 'NOMAD_IFACE') | default(ansible_default_ipv4.interface, true) }}"
nomad_iface_serf: "{{ lookup('env', 'NOMAD_IFACE') | default(ansible_default_ipv4.interface, true) }}"
nomad_node_name: "{{ inventory_hostname_short }}"
nomad_node_role: "{{ lookup('env', 'NOMAD_NODE_ROLE') | default('client', true) }}"
nomad_leave_on_terminate: true
Expand Down Expand Up @@ -131,8 +134,17 @@ nomad_plugins: {}
nomad_template_config: {}
### Addresses
nomad_bind_address: "{{ hostvars[inventory_hostname]['ansible_' + nomad_iface]['ipv4']['address'] }}"

nomad_bind_address_http: "{{ hostvars[inventory_hostname]['ansible_' + nomad_iface_http]['ipv4']['address'] }}"
nomad_bind_address_rpc: "{{ hostvars[inventory_hostname]['ansible_' + nomad_iface_rpc]['ipv4']['address'] }}"
nomad_bind_address_serf: "{{ hostvars[inventory_hostname]['ansible_' + nomad_iface_serf]['ipv4']['address'] }}"

nomad_advertise_address: "{{ hostvars[inventory_hostname]['ansible_' + nomad_iface]['ipv4']['address'] }}"

nomad_advertise_address_http: "{{ hostvars[inventory_hostname]['ansible_' + nomad_iface_http]['ipv4']['address'] }}"
nomad_advertise_address_rpc: "{{ hostvars[inventory_hostname]['ansible_' + nomad_iface_rpc]['ipv4']['address'] }}"
nomad_advertise_address_serf: "{{ hostvars[inventory_hostname]['ansible_' + nomad_iface_serf]['ipv4']['address'] }}"

### Ports
nomad_ports:
http: "{{ nomad_ports_http | default('4646', true) }}"
Expand Down
11 changes: 8 additions & 3 deletions templates/base.hcl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ disable_update_check = {{ nomad_disable_update_check | bool | lower }}


bind_addr = "{{ nomad_bind_address }}"
addresses {
http = "{{ nomad_bind_address_http }}"
rpc = "{{ nomad_bind_address_rpc }}"
serf = "{{ nomad_bind_address_serf }}"
}
advertise {
http = "{{ nomad_advertise_address }}:{{ nomad_ports.http }}"
rpc = "{{ nomad_advertise_address }}:{{ nomad_ports.rpc }}"
serf = "{{ nomad_advertise_address }}:{{ nomad_ports.serf }}"
http = "{{ nomad_advertise_address_http }}:{{ nomad_ports.http }}"
rpc = "{{ nomad_advertise_address_rpc }}:{{ nomad_ports.rpc }}"
serf = "{{ nomad_advertise_address_serf }}:{{ nomad_ports.serf }}"
}
ports {
http = {{ nomad_ports['http'] }}
Expand Down