61 lines
1.9 KiB
YAML
61 lines
1.9 KiB
YAML
---
|
|
# hashistack configuration merging for consul
|
|
- name: "Consul | Merge stringified configuration"
|
|
vars:
|
|
_config_to_merge: "{{ hashi_consul_configuration_string }}"
|
|
ansible.builtin.set_fact:
|
|
hashi_consul_configuration: "{{
|
|
hashi_consul_configuration |
|
|
combine(_config_to_merge|from_yaml)
|
|
}}"
|
|
when: hashi_consul_configuration_string is defined
|
|
|
|
- name: "Consul | Merge addresses configuration"
|
|
vars:
|
|
_config_to_merge: "{{ consul_address_configuration }}"
|
|
ansible.builtin.set_fact:
|
|
hashi_consul_configuration: "{{
|
|
hashi_consul_configuration |
|
|
combine(_config_to_merge)
|
|
}}"
|
|
when: consul_address_configuration is defined
|
|
|
|
- name: "Consul | Merge token configuration"
|
|
delegate_to: localhost
|
|
block:
|
|
- name: "Consul | Stat consul secrets file"
|
|
ansible.builtin.stat:
|
|
path: "{{ sub_configuration_directories.consul_servers }}/consul_config.yml"
|
|
register: _consul_config_file
|
|
|
|
- name: "Consul | Load consul secrets file"
|
|
ansible.builtin.include_vars:
|
|
file: "{{ sub_configuration_directories.consul_servers }}/consul_config.yml"
|
|
name: _consul_cluster_config
|
|
when: _consul_config_file.stat.exists
|
|
|
|
- name: "Merge token configuration"
|
|
vars:
|
|
_config_to_merge:
|
|
acl:
|
|
tokens: "{{ _consul_cluster_config.tokens }}"
|
|
ansible.builtin.set_fact:
|
|
hashi_consul_configuration: "{{ hashi_consul_configuration | default({}) | combine(_config_to_merge, recursive=true) }}"
|
|
when: _consul_cluster_config.tokens is defined
|
|
|
|
- name: Debug token config
|
|
ansible.builtin.debug:
|
|
msg: "{{ hashi_consul_configuration }}"
|
|
|
|
# - fail:
|
|
|
|
- name: "Consul | Merge extra configuration settings"
|
|
vars:
|
|
_config_to_merge: "{{ consul_extra_configuration }}"
|
|
ansible.builtin.set_fact:
|
|
hashi_consul_configuration: "{{
|
|
hashi_consul_configuration |
|
|
combine(_config_to_merge)
|
|
}}"
|
|
when: consul_extra_configuration is defined
|