forked from ptoscano/candlepin-container-unofficial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
playbook.yml
118 lines (106 loc) · 2.68 KB
/
playbook.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
- hosts: localhost
tasks:
- name: Enable multi-user.target
become: true
command:
argv:
- systemctl
- start
- multi-user.target
- name: Upload custom.yaml
copy:
src: res/custom.yaml
dest: /home/candlepin/devel/candlepin/custom.yaml
mode: preserve
- name: Deploy Candlepin
include_role:
name: candlepin
vars:
cp_deploy_args: "-g -a -f -t -r -H"
- name: Enable tomcat
become: true
service:
name: tomcat
enabled: true
- name: Stop tomcat
become: true
service:
name: tomcat
state: stopped
- name: Switch mode back to standalone
become: true
ansible.builtin.lineinfile:
path: /etc/candlepin/candlepin.conf
regexp: '^candlepin.standalone='
line: candlepin.standalone=true
- name: Kill gradle process
command:
argv:
- pkill
- "-e"
- "-f"
- gradle
- name: Replace context.xml with working one
become: true
copy:
src: res/context.xml
dest: /var/lib/tomcat/webapps/ROOT/META-INF/context.xml
mode: preserve
owner: tomcat
group: tomcat
- name: Drop no more needed packages
become: true
dnf:
name:
- git-core
- python3-psycopg2
- createrepo_c
- expect
- gettext
- hostname
- man-db
- python-unversioned-command
- python3-libxml2
- python3-requests
- python3-six
- policycoreutils-python-utils
- procps
- rpm-build
- rpm-sign
- unzip
- "*-srpm-macros"
state: absent
autoremove: true
- name: Cleanups
become: true
file:
path: "{{ item }}"
state: absent
loop:
- /home/candlepin/.java
- /home/candlepin/devel/candlepin/build
- /home/candlepin/devel/candlepin/buildSrc/build
- /root/rpmbuild
- /var/cache/dnf
- /var/lib/tomcat/webapps/candlepin.war
- /var/tmp/candlepin
- name: Find .gradle directories
find:
paths: /home/candlepin
patterns: .gradle
hidden: true
recurse: true
file_type: directory
register: gradle_dirs
- name: Cleanups (.gradle directories)
become: true
file:
path: "{{ item }}"
state: absent
loop:
"{{ gradle_dirs.files | map(attribute='path') }}"
- name: Cleanups (via shell)
become: true
shell: |
set -euo pipefail
rm -rf /usr/share/doc/* /usr/share/man/*