diff --git a/tasks/update/disable_fencing.yaml b/tasks/update/disable_fencing.yaml new file mode 100644 index 00000000..a5d47254 --- /dev/null +++ b/tasks/update/disable_fencing.yaml @@ -0,0 +1,23 @@ +--- +- name: verify if fencing is enabled before running overcloud update + become: true + become_user: "{{ (overcloud_ssh_user) | ternary(overcloud_ssh_user, 'heat-admin') }}" + delegate_to: "{{ controller_host }}" + shell: "sudo pcs property config stonith-enabled | tail -1" + register: pcs_out + changed_when: false + failed_when: false + +- block: + - name: set EnableFencing to false in fencing.yaml + replace: + path: "{{ working_dir }}/fencing.yaml" + regexp: "EnableFencing: true" + replace: "EnableFencing: false" + + - name: disable fencing before running update + become: true + become_user: "{{ (overcloud_ssh_user) | ternary(overcloud_ssh_user, 'heat-admin') }}" + delegate_to: "{{ controller_host }}" + shell: "sudo pcs property set stonith-enabled=false" + when: pcs_out.stdout.find('true') != -1 diff --git a/tasks/update/enable_fencing.yaml b/tasks/update/enable_fencing.yaml new file mode 100644 index 00000000..e5839455 --- /dev/null +++ b/tasks/update/enable_fencing.yaml @@ -0,0 +1,28 @@ +--- +- name: Check if fencing.yaml file is present + stat: + path: "{{ working_dir }}/fencing.yaml" + register: fencing_file + +- name: verify the fencing status after update + become: true + become_user: "{{ (overcloud_ssh_user) | ternary(overcloud_ssh_user, 'heat-admin') }}" + delegate_to: "{{ controller_host }}" + shell: "sudo pcs property config stonith-enabled | tail -1" + register: pcs_out + changed_when: false + failed_when: false + +- block: + - name: set EnableFencing to true in fencing.yaml + replace: + path: "{{ working_dir }}/fencing.yaml" + regexp: "EnableFencing: false" + replace: "EnableFencing: true" + + - name: enable fencing after running update + become: true + become_user: "{{ (overcloud_ssh_user) | ternary(overcloud_ssh_user, 'heat-admin') }}" + delegate_to: "{{ controller_host }}" + shell: "sudo pcs property set stonith-enabled=true" + when: pcs_out.stdout.find('false') != -1 and fencing_file.stat.exists diff --git a/tasks/update/main.yml b/tasks/update/main.yml index e63aec01..41c113a2 100644 --- a/tasks/update/main.yml +++ b/tasks/update/main.yml @@ -98,6 +98,12 @@ - updates_validations - pre_update_prepare_validations + - set_fact: + controller_host: "{{ inventory_hostmap[controller_role_name]|first }}" + + - name: run pre-update fencing check + import_tasks: disable_fencing.yaml + - name: import oc update prepare tasks import_tasks: overcloud_update_prepare.yml tags: @@ -201,6 +207,9 @@ ./overcloud_online_data_migration.sh 2>&1 {{ timestamper_cmd }} >> \ overcloud_update_data_migration.log + - name: run post-update fencing check + import_tasks: enable_fencing.yaml + - name: run post-update validation import_tasks: ../common/validation_group_run.yaml vars: