Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linter for Consul #370

Merged
merged 4 commits into from
Jun 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .config/ansible-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
2 changes: 1 addition & 1 deletion roles/consul/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion roles/consul/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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) }}"
Expand Down
2 changes: 1 addition & 1 deletion roles/consul/tasks/dnsmasq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
4 changes: 3 additions & 1 deletion roles/consul/tasks/encrypt_gossip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion roles/consul/templates/config.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 '' }}
Expand Down