forked from redhat-cop/automate-tower-ha-dr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tower-ha-failover.yml
66 lines (54 loc) · 1.86 KB
/
tower-ha-failover.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
- name: set fact for for failback flag
hosts: all:localhost
gather_facts: no
pre_tasks:
- name: set a local fact as boolean
set_fact:
_tower_failback: "{{ tower_failback | default(False) | bool }}"
- name: setup inventory to shutdown services
hosts: localhost
gather_facts: no
vars_files: tower-vars.yml
roles:
- role: tower_inventory
tower_inventory_file: "{{ tower_inventory_ha if _tower_failback else tower_inventory_pm }}"
- import_playbook: tower-stop-services.yml
- name: setup inventory for backup site or primary site in failback
hosts: localhost
vars_files: tower-vars.yml
gather_facts: no
roles:
- role: tower_inventory
tower_inventory_file: "{{ tower_inventory_pm if _tower_failback else tower_inventory_ha }}"
# when there is no replica, no action will be taken
- import_playbook: tower-pgsql-promote.yml
- name: setup inventory for HA site or primary site in failback and rerun tower installer
hosts: tower
vars_files: tower-vars.yml
vars:
_tower_eng_failover: "{{ tower_eng_failover | default(False) | bool }}"
tasks:
- block:
- include_role:
name: tower_install
vars:
tower_install_inventory: "{{ ansible_inventory_sources[0] }}"
tower_install_directory: "{{ tower_installer_current }}"
tower_install_skip_run: "{{ tower_install_skip }}"
tower_install_ram_override: "{{ tower_ram_override }}"
delegate_to: localhost
run_once: true
when: not _tower_eng_failover
- name: shortcut/engineering cluster failover
block:
- name: point tower to new master database
include_role:
name: tower_db_active
- name: perform rabbitmq and cluster setup
include_role:
name: tower_cluster
when: _tower_eng_failover
become: true
- import_playbook: tower-setup-replication.yml
- import_playbook: tower-check-replication.yml