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

Add conditional failure for 12sp5 AWS fencing #257

Merged
merged 1 commit into from
Aug 8, 2024
Merged
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
35 changes: 26 additions & 9 deletions ansible/playbooks/tasks/cluster-bootstrap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,16 @@
migration_threshold: "{{ (crm_rsc_options_show.stdout | regex_search('migration-threshold=([0-9]*)', '\\1'))[0] | default('false') }}"
op_default_timeout: "{{ (crm_op_options_show.stdout | regex_search('timeout=([0-9]*)', '\\1'))[0] | default('false') }}"

- name: Set corosync facts
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: Set corosync facts
- name: Compose AWS stonith command

ansible.builtin.set_fact:
aws_stonith_cmd: |
crm configure primitive rsc_aws_stonith stonith:external/ec2 \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from optional make static-ansible-lint target

jinja[spacing]: Jinja2 spacing could be improved: crm configure primitive rsc_aws_stonith stonith:external/ec2 \
op start interval=0 timeout=180 \
op stop interval=0 timeout=180 \
op monitor interval=120 timeout=60 \
meta target-role=Started \
params tag={{ aws_stonith_tag}} pcmk_delay_max=15
 -> crm configure primitive rsc_aws_stonith stonith:external/ec2 \
op start interval=0 timeout=180 \
op stop interval=0 timeout=180 \
op monitor interval=120 timeout=60 \
meta target-role=Started \
params tag={{ aws_stonith_tag }} pcmk_delay_max=15
 (warning)
ansible/playbooks/tasks/cluster-bootstrap.yaml:227 Jinja2 template rewrite recommendation: `crm configure primitive rsc_aws_stonith stonith:external/ec2 \
op start interval=0 timeout=180 \
op stop interval=0 timeout=180 \
op monitor interval=120 timeout=60 \
meta target-role=Started \
params tag={{ aws_stonith_tag }} pcmk_delay_max=15

op start interval=0 timeout=180 \
op stop interval=0 timeout=180 \
op monitor interval=120 timeout=60 \
meta target-role=Started \
params tag={{ aws_stonith_tag}} pcmk_delay_max=15
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
params tag={{ aws_stonith_tag}} pcmk_delay_max=15
params tag={{ aws_stonith_tag }} pcmk_delay_max=15


- name: Enable SBD [sbd]
ansible.builtin.command:
cmd: crm configure primitive rsc_iscsi_sbd stonith:external/sbd
Expand All @@ -230,18 +240,25 @@
- use_sbd
- is_primary

- name: Configure AWS EC2 STONITH
ansible.builtin.command: >
crm configure primitive rsc_aws_stonith stonith:external/ec2
op start interval=0 timeout=180
op stop interval=0 timeout=180
op monitor interval=120 timeout=60
meta target-role=Started
params tag={{ aws_stonith_tag}} pcmk_delay_max=15
- name: Configure AWS EC2 STONITH for sle 12sp5
ansible.builtin.command: "{{ aws_stonith_cmd }}"
when:
- is_primary
- cloud_platform_is_aws
- not (use_sbd | bool)
- ansible_distribution_major_version == '12'
register: stonith_config_result
failed_when: >
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect

stonith_config_result.stderr_lines | select("match", "ERROR") | reject("match", "ERROR: warning") | list | length > 0


- name: Configure AWS EC2 STONITH for sle 15
ansible.builtin.command: "{{ aws_stonith_cmd }}"
when:
- is_primary
- cloud_platform_is_aws
- not (use_sbd | bool)
- ansible_distribution_major_version != '12'
register: stonith_config_result
failed_when: "'ERROR' in stonith_config_result.stderr"

Expand Down Expand Up @@ -401,7 +418,7 @@
when:
- is_primary
- reg_vip_location.stdout | trim | split(' ') | last != primary_hostname
until: reg_vip_location2.stdout_lines[0] | trim | split(' ') | last == primary_hostname
until: reg_vip_location2.stdout_lines | length > 0 and reg_vip_location2.stdout_lines[0] | trim | split(' ') | last == primary_hostname
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This addresses Problem 3: it adds a check for output length, so the task retries if the output is not yet ready instead of immediately failing

retries: 10
delay: 6

Expand Down
Loading