yoho.switch-db.yml
837 Bytes
---
- hosts: "{{ db_mgmt }}"
remote_user: root
vars_prompt:
- name: "confirmation"
prompt: "Switch DB master. Please Enter DB to continue."
private: no
tasks:
- name: Check slave before switch
command: bash /root/switch/switch_before_check_slave.sh
register: switch_check
failed_when: switch_check.stdout.find('No') != -1
changed_when: False
- name: --ZONE1-- Start switching to Zone1
command: bash /root/switch/switch_az1.sh
register: switch_db_to_az1
failed_when: switch_db_to_az1.stdout.find('failed') != -1
when: center == 'zone1'
- name: --ZONE2-- Start switching to Zone2
command: bash /root/switch/switch_az2.sh
register: switch_db_to_az2
failed_when: switch_db_to_az2.stdout.find('failed') != -1
when: center == 'zone2'