-
Notifications
You must be signed in to change notification settings - Fork 0
/
playbook.yml
254 lines (229 loc) · 7.44 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
---
- name: Gazeto Client installer for RPi
hosts:
- localhost
tasks:
- name: Update package list
ansible.builtin.apt:
update_cache: yes
become: "yes"
- name: Update all installed packages
ansible.builtin.apt:
upgrade: "safe"
become: "yes"
- name: Install packages
ansible.builtin.apt:
name:
- nginx
- fbi
- php8.2-bcmath
- php8.2-cli
- php8.2-common
- php8.2-curl
- php8.2-gmp
- php8.2-intl
- php8.2-mbstring
- php8.2-opcache
- php8.2-sqlite3
- php8.2-xml
- php8.2-xsl
- php8.2-zip
- composer
- unzip
- zip
- htop
- ansible
- git
- screen
- inxi
- ttf-mscorefonts-installer
- fonts-open-sans
- cron-apt
state: present
become: "yes"
### Custom boot logo
- name: Copy theme
ansible.builtin.copy:
src: gazeto-plymouth-theme/
dest: /usr/share/plymouth/themes/gazeto-plymouth-theme
force: "true"
owner: root
group: root
mode: "u=rw,g=r,o=r"
directory_mode: "u=rwx,g=rx,o=rx"
become: "yes"
- name: Download splash image
ansible.builtin.get_url:
url: https://www.markeigazeto.nl/client/splash.png
dest: /usr/share/plymouth/themes/gazeto-plymouth-theme/splash.png
force: "true"
owner: root
group: root
mode: "u=rw,g=r,o=r"
become: "yes"
- name: Build theme for initrd
when: "'Theme=gazeto-plymouth-theme' not in lookup('file', '/etc/plymouth/plymouthd.conf')"
ansible.builtin.command:
cmd: plymouth-set-default-theme --rebuild-initrd gazeto-plymouth-theme
become: "yes"
### Custom wallpaper
- name: Set wallpaper
ansible.builtin.lineinfile:
path: "{{ item.file }}"
regexp: '^wallpaper='
line: wallpaper=/usr/share/plymouth/themes/gazeto-plymouth-theme/splash.png
loop:
- { file: /etc/xdg/pcmanfm/LXDE-pi/desktop-items-0.conf }
- { file: /etc/xdg/pcmanfm/LXDE-pi/desktop-items-1.conf }
become: "yes"
### Hide the mouse
- name: Install interception-tools
ansible.builtin.apt:
name:
- interception-tools
- interception-tools-compat
- cmake
state: present
become: "yes"
- name: Clone hideaway repo
ansible.builtin.git:
clone: "true"
dest: /root/hideaway
repo: https://gitlab.com/interception/linux/plugins/hideaway.git
update: no
become: "yes"
- name: Build hideaway
ansible.builtin.command:
chdir: /root/hideaway
cmd: "{{ item }}"
loop:
- "cmake -B build -DCMAKE_BUILD_TYPE=Release"
- "cmake --build build"
become: "yes"
- name: Copy hideaway build result
ansible.builtin.copy:
remote_src: "yes"
src: /root/hideaway/build/hideaway
dest: /usr/bin/hideaway
owner: root
group: root
mode: "u=rwx,g=rx,o=rx"
force: "true"
become: "yes"
- name: Copy udevmon.d config file
ansible.builtin.copy:
src: udevmon.d/config.yaml
dest: /etc/interception/udevmon.d/config.yaml
owner: root
group: root
mode: "u=rw,g=r,o=r"
force: "true"
become: "yes"
### Configure Nginx
- name: Copy Nginx default template
ansible.builtin.copy:
src: "nginx/default.template"
dest: "/etc/nginx/default.template"
owner: root
group: root
mode: "u=rw,g=r,o=r"
force: "true"
become: "yes"
- name: Replace tokens in template
ansible.builtin.command:
cmd: php /opt/gazeto-client/client-controller/src/update-nginx-conf.php
become: "yes"
### Configure Firefox
- name: Create Firefox policy directory
ansible.builtin.file:
path: "/etc/firefox/policies"
state: "directory"
owner: root
group: root
mode: "u=rwx,g=rx,o=rx"
become: "yes"
- name: Copy Firefox policies
ansible.builtin.copy:
src: "firefox/policies.json"
dest: "/etc/firefox/policies/policies.json"
owner: root
group: root
mode: "u=rw,g=r,o=r"
force: "true"
become: "yes"
### Autostart Firefox
- name: Copy auto start file
ansible.builtin.copy:
src: "start.sh"
dest: "/home/pi/.config/start.sh"
owner: pi
group: pi
mode: "u=rwx,g=rx,o=rx"
force: true
become: "yes"
- name: Add autostart block in file
# ansible.builtin.blockinfile:
# path: /home/pi/.config/wayfire.ini
# block: |
# [autostart]
# runme = /usr/bin/chromium-browser --kiosk --kiosk-mode-incognito --kiosk-mode-no-prompts --kiosk-mode-no-dialogs http://localhost/client
# block: |
# [autostart]
# runme = sleep 5 && /usr/bin/firefox --display=:0 --kiosk-monitor 0 --private-window --kiosk http://localhost/client block: |
# block: |
# [autostart]
# runme = /home/pi/.config/start.sh
community.general.ini_file:
path: /home/pi/.config/wayfire.ini
section: "autostart"
option: runme
value: /home/pi/.config/start.sh
state: present
become: "yes"
### Install services
- name: Install composer packages
community.general.composer:
command: install
working_dir: /opt/gazeto-client/client-controller
no_scripts: "true"
no_plugins: "true"
environment:
COMPOSER_ALLOW_SUPERUSER: "1"
become: "yes"
- name: Install Gazeto services
ansible.builtin.copy:
src: "{{ item.file }}"
dest: "/etc/systemd/system/{{ item.file }}"
owner: root
group: root
mode: "u=rw,g=r,o=r"
force: "true"
loop:
- { file: gazeto-init.service, name: Gazeto Init }
- { file: gazeto-worker.service, name: Gazeto Worker }
loop_control:
label: "Install {{ item.name }}"
become: "yes"
- name: Enable Gazeto services
ansible.builtin.systemd_service:
name: "{{ item.service }}"
enabled: "true"
state: "started"
loop:
- { service: gazeto-init.service, name: Gazeto Init }
- { service: gazeto-worker.service, name: Gazeto Worker }
loop_control:
label: "Install {{ item.name }}"
become: "yes"
### Hourly report
- name: Hourly report
ansible.builtin.cron:
name: "Report to Gazeto"
day: "*"
hour: "*"
minute: "{{ ['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']|random }}"
month: "*"
user: "pi"
weekday: "*"
job: "php /opt/gazeto-client/client-controller/report.php"
become: "yes"