-
Notifications
You must be signed in to change notification settings - Fork 38
/
tower-uninstall.yml
104 lines (94 loc) · 2.11 KB
/
tower-uninstall.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
---
- hosts: all
gather_facts: no
become: true
vars:
pkgs_to_remove:
- ansible-tower*
- rabbitmq-server*
- '*postgresql*'
dep_pkgs_to_remove:
- ansible
- python2-jmespath
- apr
- apr-util
- bubblewrap
- erlang
- gd
- git
- gperftools-libs
- libXpm
- libgnome-keyring
- libsemanage-python
- libunwind
- memcached
- mercurial
- neon
- nginx*
- pakchois
- perl-Error
- perl-Git
- perl-TermReadKey
# postgresql96 and libs should be covered by pkgs_to_remove
#- postgresql96
#- postgresql96-libs
- python-devel
- python-meld3
- python-virtualenv
- rabbitmq-server
- socat
- subversion
- subversion-libs
- supervisor
- python-psycopg2
- setools-libs
files_to_remove:
- /etc/tower
- /var/log/tower
- /etc/yum.repos.d/ansible-tower.repo
parent_dirs_to_remove:
- /var/lib/pgsql
- /var/lib/awx
- /var/lib/rabbitmq
tasks:
- name: ensure tower services are stopped
command: ansible-tower-service stop
ignore_errors: yes
- name: remove packages
yum:
name: "{{ pkgs_to_remove }}"
state: absent
- name: remove dep packages
yum:
name: "{{ dep_pkgs_to_remove }}"
state: absent
when: uninstall_deps | default(false)
- name: get awx dir list
find:
paths: "{{ parent_dirs_to_remove }}"
recurse: no
file_type: any
register: awx_paths
- name: set awx file list
set_fact:
awx_file_list: awx_paths.files | json_query('[*].path')
- name: cleanup files
file:
path: "{{ item }}"
state: absent
loop:
- "{{ files_to_remove }}"
- "{{ awx_file_list }}"
# handles case where top-level dir is a mountpoint
- name: cleanup parent directories
file:
path: "{{ item }}"
state: absent
loop: "{{ parent_dirs_to_remove }}"
ignore_errors: yes
- name: clean yum cache
command: "{{ item }}"
loop:
- "yum clean all"
- "rm -rf /var/cache/yum"
# Review Support article for more information https://access.redhat.com/solutions/3107181