-
Notifications
You must be signed in to change notification settings - Fork 0
/
site-uninstall-all.yml
67 lines (63 loc) · 1.88 KB
/
site-uninstall-all.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: Init deploy
hosts: localhost
become: yes
become_user: root
connection: local
any_errors_fatal: true
gather_facts: no
tasks:
- debug:
msg:
- "**********************************************************************************"
- "================== Uninstart Deploying mosquitto ========================="
- "**********************************************************************************"
- name:
wait_for:
delay: 3
timeout: 0
- name: Gather system time
setup:
filter: ansible_date_time
- name: Set start time
set_fact:
time_start: "{{ ansible_date_time.epoch }}"
- debug: var=ansible_date_time.date
- debug: var=ansible_date_time.time
- name: uninstall nginx and keepalived
hosts: "{{ hosts | default('mosquitto-nginx-keepalived') }}"
gather_facts: no
become: yes
become_user: root
any_errors_fatal: true
tasks:
- name: uninstall nginx
shell: yum -y remove nginx
ignore_errors: yes
- name: uninstall keepalived
shell: yum -y remove keepalived
ignore_errors: yes
- name: mosquitto uinstall
hosts: "{{ hosts | default('mosquitto-master,mosquitto-broker,mosquitto-nginx-keepalived,add-broker') }}"
gather_facts: no
become: yes
become_user: root
any_errors_fatal: true
tasks:
- name: Get running processes
shell: kill -9 $(ps -ef | grep -v grep | egrep -w 'mosquitto|Service_detect' | awk '{print $2}')
ignore_errors: yes
- name: delete all file
file:
dest: "{{item.dest}}"
state: absent
with_items:
- { dest: "{{target_dir}}/libwebsockets" }
- { dest: "{{target_dir}}/mosquitto" }
- { dest: "/var/log/mosquitto/" }
- { dest: "/etc/mosquitto" }
- { dest: "/usr/local/sbin/mosquitto" }
- { dest: "/var/spool/mail/mosquitto" }