-
-
Notifications
You must be signed in to change notification settings - Fork 175
/
Copy pathplaybook.yml
288 lines (242 loc) · 7.15 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
---
- name: Installation and configuration of/in Open Semantic Desktop Search VM
hosts: all
tasks:
- name: Add Debian Repos contrib and non-free
ansible.builtin.apt_repository:
repo: deb http://deb.debian.org/debian bullseye main contrib non-free
state: present
become: yes
- name: Upgrade the OS (apt-get dist-upgrade)
apt:
upgrade: dist
update_cache: yes
become: yes
- name: Install Desktop environment
apt:
name: task-desktop
become: yes
- name: Stop Gnome Display Manager
ansible.builtin.service:
name: gdm
state: stopped
become: yes
- name: Install zenity
apt:
name: zenity
become: yes
- name: Copy Open Semantic Search deb package to VM
ansible.builtin.copy:
src: open-semantic-search.deb
dest: /open-semantic-search.deb
become: yes
- name: Install Open Semantic Search deb package
apt:
deb: /open-semantic-search.deb
become: yes
- name: Stop cron
ansible.builtin.service:
name: cron
state: stopped
become: yes
- name: Stop Flower
ansible.builtin.service:
name: flower
state: stopped
become: yes
- name: Stop Apache
ansible.builtin.service:
name: apache2
state: stopped
become: yes
- name: Stop spaCy
ansible.builtin.service:
name: spacy
state: stopped
become: yes
- name: Stop Filemonitoring
ansible.builtin.service:
name: opensemanticetl-filemonitoring
state: stopped
become: yes
- name: Stop ETL workers
ansible.builtin.service:
name: opensemanticetl
state: stopped
become: yes
- name: Stop RabbitMQ
ansible.builtin.service:
name: rabbitmq-server
state: stopped
become: yes
- name: Stop Solr
ansible.builtin.service:
name: solr
state: stopped
become: yes
- name: Stop Tika
ansible.builtin.service:
name: tika
state: stopped
become: yes
- name: Stop Tika Fake OCR service
ansible.builtin.service:
name: tika-fake-ocr
state: stopped
become: yes
- name: Remove deb package
file:
state: absent
path: /open-semantic-search.deb
become: yes
- name: Remove packages that are no longer required
apt:
autoremove: yes
become: yes
- name: Apt - Removes all packages from the package cache
command: apt-get clean
become: yes
- name: Delete cache of Python package manager pip
file:
state: absent
path: /root/.cache/pip
become: yes
- name: Add group vboxsf to user opensemanticetl for access to document index in shared folder
ansible.builtin.user:
name: opensemanticetl
groups: vboxsf
append: yes
become: yes
- name: Add group vboxsf to user solr for access to document index in shared folder
ansible.builtin.user:
name: solr
groups: vboxsf
append: yes
become: yes
- name: Copy custom ETL config files
ansible.builtin.copy:
src: etc/opensemanticsearch
dest: /etc/
owner: root
group: root
become: yes
# Todo: Idempotency
- name: Create Django superuser admin with password live
command: |
python3 /var/lib/opensemanticsearch/manage.py shell -c "from django.contrib.auth.models import User; User.objects.create_superuser('admin', 'user@localhost', 'live')"
become: yes
- name: Create group user
ansible.builtin.group:
name: user
become: yes
- name: Add user
ansible.builtin.user:
name: user
comment: User
group: user
shell: /bin/bash
# Add to group sudo for root access
# Add to group vboxsf for access to shared folders of the VM
groups: sudo, vboxsf
append: yes
become: yes
- name: Empty password for user
command: passwd -d user
become: yes
- name: Empty password for root
command: passwd -d root
become: yes
- name: Link Documents folder to shared folders mount path
file:
src: "/media"
dest: "/home/user/Documents"
state: link
become: yes
- name: Status shared folder for document index
stat: path=/media/sf_index
register: data_solr
become: yes
- name: Move document index to shared folder
command: mv /var/solr/data/opensemanticsearch/data /media/sf_index
when: not data_solr.stat.exists
become: yes
- name: Link old pathname of document index to this shared folder
file:
src: "/media/sf_index"
dest: "/var/solr/data/opensemanticsearch/data"
state: link
become: yes
- name: Allow Firefox to open local file links linked by localhost
ansible.builtin.copy:
src: etc/firefox
dest: /etc/
owner: root
group: root
become: yes
- name: Copy GUI scripts to usr/bin
ansible.builtin.copy:
src: usr/bin
dest: /usr/
owner: root
group: root
mode: 0755
become: yes
- name: Copy home with Gnome app configs of the GUI scripts
ansible.builtin.copy:
src: home/user
dest: /home/
owner: user
group: user
become: yes
- name: Add this Gnome apps to favorites / application sidebar
community.general.dconf:
key: "/org/gnome/shell/favorite-apps"
value: "['search.desktop', 'thesaurus.desktop', 'extract-entities.desktop', 'search-list.desktop', 'index-documents.desktop', 'firefox-esr.desktop', 'org.gnome.Nautilus.desktop', 'yelp.desktop']"
state: present
become: yes
become_user: user
- name: Disable automatic screen lock
community.general.dconf:
key: "/org/gnome/desktop/screensaver/lock-enabled"
value: "false"
state: present
become: yes
become_user: user
- name: Set User for AutomaticLogin
lineinfile:
path: /etc/gdm3/daemon.conf
regexp: '^AutomaticLogin ='
insertafter: '^# Enabling automatic login'
line: 'AutomaticLogin = user'
become: yes
- name: Enable AutomaticLogin
lineinfile:
path: /etc/gdm3/daemon.conf
regexp: '^AutomaticLoginEnable ='
insertafter: '^# Enabling automatic login'
line: 'AutomaticLoginEnable = true'
become: yes
- name: Overwrite deleted files with zeros for better compression of disk image export
shell: dd if=/dev/zero of=/ZEROS bs=1M; sync; rm -f /ZEROS
become: yes
- name: Create swap file
command: fallocate -l 4G /swapfile
become: yes
- name: change swap file permissions
file:
path: /swapfile
owner: root
group: root
mode: 0600
become: yes
- name: Format swap file
command: mkswap /swapfile
become: yes
- name: Mount entry for swap file
mount:
src: /swapfile
path: none
fstype: swap
opts: sw
state: present
become: yes