diff --git a/.config/ansible-lint.yml b/.config/ansible-lint.yml index 6d572aed1..3bf0120ce 100644 --- a/.config/ansible-lint.yml +++ b/.config/ansible-lint.yml @@ -28,7 +28,6 @@ skip_list: - yaml[truthy] exclude_paths: - - ../roles/consul/ # TODO - https://github.com/ansible-community/ansible-consul/pull/520 - ../.venv # https://ansible-lint.readthedocs.io/configuring/ # https://ansible-lint.readthedocs.io/rules/ diff --git a/roles/consul/README.md b/roles/consul/README.md index 7583fab18..6812ab4d9 100644 --- a/roles/consul/README.md +++ b/roles/consul/README.md @@ -769,7 +769,7 @@ https://www.consul.io/docs/guides/autopilot.html - Override with `CONSUL_AUTOPILOT_ENABLE` environment variable - Default value: false -#### `consul_autopilot_cleanup_dead_Servers` +#### `consul_autopilot_cleanup_dead_servers` Dead servers will periodically be cleaned up and removed from the Raft peer set, to prevent them from interfering with the quorum size and leader elections. This cleanup will also happen whenever a new server is successfully added to the cluster. diff --git a/roles/consul/defaults/main.yml b/roles/consul/defaults/main.yml index 44061611f..dd7ba263f 100644 --- a/roles/consul/defaults/main.yml +++ b/roles/consul/defaults/main.yml @@ -107,7 +107,7 @@ consul_env_vars: ### Autopilot consul_autopilot_enable: "{{ lookup('env', 'CONSUL_AUTOPILOT_ENABLE') | default(false, true) }}" -consul_autopilot_cleanup_dead_Servers: "{{ lookup('env', 'CONSUL_AUTOPILOT_CLEANUP_DEAD_SERVERS') | default(false, true) }}" +consul_autopilot_cleanup_dead_servers: "{{ lookup('env', 'CONSUL_AUTOPILOT_CLEANUP_DEAD_SERVERS') | default(false, true) }}" consul_autopilot_last_contact_threshold: "{{ lookup('env', 'CONSUL_AUTOPILOT_LAST_CONTACT_THRESHOLD') | default('200ms', true) }}" consul_autopilot_max_trailing_logs: "{{ lookup('env', 'CONSUL_AUTOPILOT_MAX_TRAILING_LOGS') | default(250, true) }}" consul_autopilot_server_stabilization_time: "{{ lookup('env', 'CONSUL_AUTOPILOT_SERVER_STABILIZATION_TIME') | default('10s', true) }}" diff --git a/roles/consul/tasks/dnsmasq.yml b/roles/consul/tasks/dnsmasq.yml index aa9b615aa..34c94318d 100644 --- a/roles/consul/tasks/dnsmasq.yml +++ b/roles/consul/tasks/dnsmasq.yml @@ -41,7 +41,7 @@ mode: 0644 become: true notify: restart dnsmasq - when: "{{ dnsmasq_item.when }}" + when: dnsmasq_item.when tags: dnsmasq loop: - { dest: '/etc/dnsmasq.d/10-consul', group: 'root', when: ansible_os_family|lower != "freebsd" } diff --git a/roles/consul/tasks/encrypt_gossip.yml b/roles/consul/tasks/encrypt_gossip.yml index 9326c91c2..7be54ee1a 100644 --- a/roles/consul/tasks/encrypt_gossip.yml +++ b/roles/consul/tasks/encrypt_gossip.yml @@ -3,7 +3,9 @@ - block: - name: Read gossip encryption key from previously boostrapped server - shell: 'cat {{ consul_config_path }}/bootstrap/config.json | grep "encrypt" | sed -E ''s/"encrypt": "(.+)",?/\1/'' | sed ''s/^ *//;s/ *$//''' + shell: | + set -o pipefail + cat {{ consul_config_path }}/bootstrap/config.json | grep "encrypt" | sed -E 's/"encrypt": "(.+)",?/\1/' | sed 's/^ *//;s/ *$//' register: consul_key_read run_once: true diff --git a/roles/consul/templates/config.json.j2 b/roles/consul/templates/config.json.j2 index 8a9bfdc0c..489a39ac2 100644 --- a/roles/consul/templates/config.json.j2 +++ b/roles/consul/templates/config.json.j2 @@ -242,7 +242,7 @@ {## AutoPilot ##} {% if consul_autopilot_enable | bool %} "autopilot": { - "cleanup_dead_servers": {{ consul_autopilot_cleanup_dead_Servers | bool | to_json }}, + "cleanup_dead_servers": {{ consul_autopilot_cleanup_dead_servers | bool | to_json }}, "last_contact_threshold": "{{ consul_autopilot_last_contact_threshold }}", "max_trailing_logs": {{ consul_autopilot_max_trailing_logs }}, "server_stabilization_time": "{{ consul_autopilot_server_stabilization_time }}"{{ ',' if consul_enterprise else '' }}