Skip to content

Commit ae4daa1

Browse files
authored
Allow to configure communication from Nomad to Consul over TLS (#129)
- Add TLS related variables to defaults/main.yml - Update base template - Update REAME.md with new variables
1 parent 899443c commit ae4daa1

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,26 @@ in many Ansible versions, so this feature might not always work.
505505
- Token to use for consul interaction
506506
- Default value: **""**
507507

508+
### `nomad_consul_ssl`
509+
510+
- Communicate with Consul over TLS
511+
- Default value: **false**
512+
513+
### `nomad_consul_ca_file`
514+
515+
- CA certificate used for Consul communication
516+
- Default value: **""**
517+
518+
### `nomad_consul_cert_file`
519+
520+
- Certificate used for Consul communication. Must also specify `nomad_consul_key_file`.
521+
- Default value: **""**
522+
523+
### `nomad_consul_key_file`
524+
525+
- Private key used for Consul communication.
526+
- Default value: **""**
527+
508528
### `nomad_bootstrap_expect`
509529

510530
- Specifies the number of server nodes to wait for before bootstrapping.

defaults/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ nomad_consul_token: ""
161161
nomad_consul_servers_service_name: "nomad-servers"
162162
nomad_consul_clients_service_name: "nomad-clients"
163163
nomad_consul_tags: {}
164+
nomad_consul_ssl: false
165+
nomad_consul_ca_file: ""
166+
nomad_consul_cert_file: ""
167+
nomad_consul_key_file: ""
164168

165169
### ACLs
166170
nomad_acl_enabled: "{{ lookup('env', 'NOMAD_ACL_ENABLED') | default('no', true) }}"

templates/base.hcl.j2

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ consul {
3838
# Enabling the server and client to bootstrap using Consul.
3939
server_auto_join = true
4040
client_auto_join = true
41+
42+
# Nomad to Consul TLS configuration
43+
ssl = {{ nomad_consul_ssl | bool | lower }}
44+
ca_file = "{{ nomad_consul_ca_file }}"
45+
cert_file = "{{ nomad_consul_cert_file }}"
46+
key_file = "{{ nomad_consul_key_file }}"
4147
}
4248
{% endif %}
4349

0 commit comments

Comments
 (0)