mirror of
https://gitea.0xace.cc/ansible-galaxy/consul.git
synced 2024-11-25 06:37:18 +00:00
35 lines
1.0 KiB
YAML
35 lines
1.0 KiB
YAML
---
|
|
- name: Merge encrypt key with config for Consul
|
|
set_fact:
|
|
consul_config: "{{ consul_config | combine(consul_config_encrypt, recursive=true) }}"
|
|
vars:
|
|
consul_config_encrypt:
|
|
encrypt: "{{ consul_raw_key }}"
|
|
when:
|
|
- consul_config.encrypt is not defined
|
|
|
|
- name: Merge config for Consul
|
|
set_fact:
|
|
consul_config_combined: "{{ consul_default_config | combine(consul_config, recursive=true) }}"
|
|
|
|
- name: Propagate consul config
|
|
copy:
|
|
content: "{{ consul_config_combined | to_nice_json }}"
|
|
dest: "{{ consul_config_path }}/consul.json"
|
|
owner: "{{ consul_user }}"
|
|
group: "{{ consul_group }}"
|
|
mode: 0644
|
|
register: consul_config_file
|
|
notify: Restart consul
|
|
|
|
- name: Remove old files
|
|
file:
|
|
path: "{{ item }}"
|
|
state: absent
|
|
loop:
|
|
- "{{ consul_config_path }}/config.json"
|
|
- "{{ consul_data_path }}/serf/local.keyring"
|
|
- "{{ consul_data_path }}/serf/remote.keyring"
|
|
- "{{ consul_data_path }}/serf/local.snapshot"
|
|
when: consul_config_file.changed
|