forked from 45Drives/terraform-ansible-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
remove-gateway.yml
67 lines (61 loc) · 1.68 KB
/
remove-gateway.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
67
---
- name: confirm whether user really meant to stop/remove gateway
hosts: localhost
gather_facts: false
vars_prompt:
- name: ireallymeanit
prompt: Are you sure you want stop/remove gateway ? This playbook will disrupt service.
default: 'no'
private: no
tasks:
- name: exit playbook, if user did not mean to stop/remove gateway
fail:
msg: >
"Exiting remove-gateway playbook, gateway was NOT stopped or removed.
To stop/remove the cluster, either say 'yes' on the prompt or
or use `-e ireallymeanit=yes` on the command line when
invoking the playbook"
when: ireallymeanit != 'yes'
- name: remove-gateway
hosts:
- sysmgr
gather_facts: false
any_errors_fatal: true
become: true
vars:
delegate_facts_host: true
pre_tasks:
- name: set gateway 'In Progress'
run_once: true
set_stats:
data:
installer_phase_gateway:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- name: gather facts
setup:
when:
- not delegate_facts_host | bool
tags:
- always
- name: gather and delegate facts
setup:
delegate_to: "{{ item }}"
delegate_facts: true
with_items: "{{ groups['all'] }}"
run_once: true
when:
- delegate_facts_host | bool
tags:
- always
tasks:
- import_role:
name: gateway-cleanup
post_tasks:
- name: set gateway 'Complete'
run_once: true
set_stats:
data:
installer_phase_gateway:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"