2024-01-25 21:40:44 +00:00
|
|
|
---
|
|
|
|
# hashistack configuration merging for consul
|
|
|
|
- name: "Consul | Merge stringified configuration"
|
|
|
|
vars:
|
2024-06-19 22:32:33 +00:00
|
|
|
_config_to_merge: "{{ hashicorp_consul_configuration_string }}"
|
2024-01-25 21:40:44 +00:00
|
|
|
ansible.builtin.set_fact:
|
2024-06-19 22:32:33 +00:00
|
|
|
hashicorp_consul_configuration: "{{
|
|
|
|
hashicorp_consul_configuration |
|
2024-04-06 21:47:35 +00:00
|
|
|
combine(_config_to_merge|from_yaml, recursive=true)
|
2024-01-25 21:40:44 +00:00
|
|
|
}}"
|
2024-03-17 18:05:02 +00:00
|
|
|
when:
|
2024-06-19 22:32:33 +00:00
|
|
|
- hashicorp_consul_configuration_string is defined
|
2024-03-17 18:05:02 +00:00
|
|
|
- "'consul_servers' in group_names"
|
2024-01-25 21:40:44 +00:00
|
|
|
|
|
|
|
- name: "Consul | Merge addresses configuration"
|
|
|
|
vars:
|
|
|
|
_config_to_merge: "{{ consul_address_configuration }}"
|
|
|
|
ansible.builtin.set_fact:
|
2024-06-19 22:32:33 +00:00
|
|
|
hashicorp_consul_configuration: "{{
|
|
|
|
hashicorp_consul_configuration |
|
2024-04-06 21:47:35 +00:00
|
|
|
combine(_config_to_merge, recursive=true)
|
2024-01-25 21:40:44 +00:00
|
|
|
}}"
|
|
|
|
when: consul_address_configuration is defined
|
|
|
|
|
2024-04-06 21:47:35 +00:00
|
|
|
- name: "Consul | Merge TLS configuration"
|
|
|
|
vars:
|
|
|
|
_config_to_merge:
|
|
|
|
tls: "{{ consul_tls_configuration }}"
|
|
|
|
ansible.builtin.set_fact:
|
2024-06-19 22:32:33 +00:00
|
|
|
hashicorp_consul_configuration: "{{
|
|
|
|
hashicorp_consul_configuration |
|
2024-04-06 21:47:35 +00:00
|
|
|
combine(_config_to_merge, recursive=true)
|
|
|
|
}}"
|
|
|
|
when: consul_enable_tls
|
|
|
|
|
2024-03-12 23:02:14 +00:00
|
|
|
- name: "Consul | Merge token configuration"
|
|
|
|
delegate_to: localhost
|
|
|
|
block:
|
2024-03-17 18:05:02 +00:00
|
|
|
- name: "Consul | Merge token configuration"
|
2024-03-12 23:02:14 +00:00
|
|
|
vars:
|
|
|
|
_config_to_merge:
|
|
|
|
acl:
|
2024-05-03 20:26:30 +00:00
|
|
|
tokens:
|
2024-05-07 17:23:48 +00:00
|
|
|
agent: "{{ _credentials.consul.tokens.agent.secret_id }}"
|
2024-03-12 23:02:14 +00:00
|
|
|
ansible.builtin.set_fact:
|
2024-06-19 22:32:33 +00:00
|
|
|
hashicorp_consul_configuration: "{{ hashicorp_consul_configuration | default({}) | combine(_config_to_merge, recursive=true) }}"
|
2024-03-17 18:05:02 +00:00
|
|
|
|
2024-01-25 21:40:44 +00:00
|
|
|
- name: "Consul | Merge extra configuration settings"
|
|
|
|
vars:
|
|
|
|
_config_to_merge: "{{ consul_extra_configuration }}"
|
|
|
|
ansible.builtin.set_fact:
|
2024-06-19 22:32:33 +00:00
|
|
|
hashicorp_consul_configuration: "{{
|
|
|
|
hashicorp_consul_configuration |
|
2024-04-06 21:47:35 +00:00
|
|
|
combine(_config_to_merge, recursive=true)
|
2024-01-25 21:40:44 +00:00
|
|
|
}}"
|
|
|
|
when: consul_extra_configuration is defined
|