-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b15d78b
commit dbc3d3e
Showing
10 changed files
with
149 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ jobs: | |
scenario: | ||
- binary | ||
- repo | ||
- update | ||
image: | ||
- name: ubuntu2204 | ||
command: /lib/systemd/systemd | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
- name: Import install playbook | ||
ansible.builtin.import_playbook: pokerops.consul.update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
--- | ||
dependency: | ||
name: galaxy | ||
options: | ||
role-file: requirements.yml | ||
requirements-file: requirements.yml | ||
driver: | ||
name: docker | ||
platforms: | ||
- name: consul-update-01 | ||
image: "geerlingguy/docker-${MOLECULE_DOCKER_IMAGE:-ubuntu2204}-ansible:latest" | ||
command: ${MOLECULE_DOCKER_COMMAND:-""} | ||
cgroupns_mode: host | ||
privileged: true | ||
pre_build_image: true | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
tmpfs: | ||
- /tmp | ||
- /opt | ||
groups: | ||
- consul | ||
- name: consul-update-02 | ||
image: "geerlingguy/docker-${MOLECULE_DOCKER_IMAGE:-ubuntu2204}-ansible:latest" | ||
command: ${MOLECULE_DOCKER_COMMAND:-""} | ||
cgroupns_mode: host | ||
privileged: true | ||
pre_build_image: true | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
tmpfs: | ||
- /tmp | ||
- /opt | ||
groups: | ||
- consul | ||
- name: consul-update-03 | ||
image: "geerlingguy/docker-${MOLECULE_DOCKER_IMAGE:-ubuntu2204}-ansible:latest" | ||
command: ${MOLECULE_DOCKER_COMMAND:-""} | ||
cgroupns_mode: host | ||
privileged: true | ||
pre_build_image: true | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
tmpfs: | ||
- /tmp | ||
- /opt | ||
groups: | ||
- consul | ||
provisioner: | ||
name: ansible | ||
config_options: | ||
defaults: | ||
remote_tmp: /tmp | ||
allow_world_readable_tmpfiles: true | ||
callbacks_enabled: ansible.posix.profile_tasks | ||
playbooks: | ||
prepare: ../common/prepare.yml | ||
converge: ../common/converge.yml | ||
side_effect: ../common/update.yml | ||
verify: ../common/verify.yml | ||
inventory: | ||
hosts: | ||
all: | ||
vars: | ||
consul_install_from_repo: true | ||
verifier: | ||
name: ansible | ||
scenario: | ||
prepare_sequence: | ||
- prepare | ||
converge_sequence: | ||
- converge | ||
destroy_sequence: | ||
- destroy | ||
cleanup_sequence: | ||
- cleanup | ||
test_sequence: | ||
- dependency | ||
- create | ||
- prepare | ||
- converge | ||
- side_effect | ||
- verify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
- name: Update Patroni Consul nodes | ||
hosts: "{{ _consul_hostgroup }}:!{{ _consul_update_skip_hostgroup }}" | ||
serial: 1 | ||
become: true | ||
any_errors_fatal: true | ||
vars_files: | ||
- main.yml | ||
vars: | ||
update_reboot: false | ||
update_cache_valid_time: 1 | ||
roles: | ||
- nephelaiio.patroni.update | ||
tasks: | ||
- name: Stop Consul service | ||
ansible.builtin.service: | ||
name: consul | ||
state: stopped | ||
|
||
- name: Reboot node | ||
ansible.builtin.reboot: | ||
|
||
- name: Verify Consul cluster status | ||
block: | ||
- name: Query Consul node cluster status | ||
ansible.builtin.shell: "consul members listNode | grep {{ inventory_hostname }} | awk '{print $3}'" | ||
register: _consul_node_status | ||
changed_when: false | ||
no_log: true | ||
|
||
- name: Check Consul node cluster status | ||
ansible.builtin.assert: | ||
that: _status == _expected | ||
fail_msg: "Expected consul node type '{{ _expected }}', got '{{ _status }}'" | ||
success_msg: "Consul node type is '{{ _status }}'" | ||
vars: | ||
_status: "{{ _consul_node_status.stdout }}" | ||
_expected: 'alive' | ||
|
||
- name: Verify Consul node type status | ||
block: | ||
- name: Query consul node cluster status | ||
ansible.builtin.shell: "consul members listNode | grep {{ inventory_hostname }} | awk '{print $4}'" | ||
register: _consul_node_type | ||
changed_when: false | ||
|
||
- name: Check consul node cluster status | ||
ansible.builtin.assert: | ||
that: _status == _expected | ||
fail_msg: "Expected consul node type '{{ _expected }}', got '{{ _status }}'" | ||
success_msg: "Consul node type is '{{ _status }}'" | ||
vars: | ||
_status: "{{ _consul_node_type.stdout }}" | ||
_expected: 'server' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters