-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.yml
316 lines (289 loc) · 8.01 KB
/
setup.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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
---
- name: ansible-media - quick start https://www.raspberrypi.org/forums/viewtopic.php?t=152490&p=999528
hosts: rpi
become_user: pi
become: yes
tasks:
- name: To disable hostapd
command: update-rc.d -f hostapd remove
become_user: root
become: yes
- name: To disable dnsmasq
command: update-rc.d -f dnsmasq remove
become_user: root
become: yes
- name: Update repro 1
lineinfile:
create: yes
state: present
dest: /etc/apt/sources.list
line: 'deb http://repozytorium.mati75.eu/raspbian jessie-backports main contrib non-free'
become_user: root
become: yes
- name: Update repro 2
lineinfile:
create: yes
state: present
dest: /etc/apt/sources.list
line: '#deb-src http://repozytorium.mati75.eu/raspbian jessie-backports main contrib non-free'
become_user: root
become: yes
- name: Update gpg pgpkeys.mit.edu1
command: "gpg --keyserver pgpkeys.mit.edu --recv-key CCD91D6111A06851"
- name: Update gpg pgpkeys.mit.edu2
command: "gpg --armor --export CCD91D6111A06851 | sudo apt-key add -"
- name: Update apt-get cache
apt: >
update_cache=yes
cache_valid_time=360
become_user: root
become: yes
- name: Update all packages to the latest version
apt: >
upgrade=yes
become_user: root
become: yes
- name: Update repositories cache and install "php5-common" package
apt:
name: php5-common
become_user: root
become: yes
- name: Update repositories cache and install "php5-cgi" package
apt:
name: php5-cgi
become_user: root
become: yes
- name: Update repositories cache and install "php5" package
apt:
name: php5
become_user: root
become: yes
- name: Update repositories cache and install "lighttpd" package
apt:
name: lighttpd
become_user: root
become: yes
- name: Update repositories cache and install "hostapd" package
apt:
name: hostapd
become_user: root
become: yes
- name: Update repositories cache and install "dnsmasq" package
apt:
name: dnsmasq
become_user: root
become: yes
- name: Update repositories cache and install "ntfs-3g" package
apt:
name: ntfs-3g
become_user: root
become: yes
- name: Update repositories cache and install "minidlna" package
apt:
name: minidlna
become_user: root
become: yes
- name: Update repositories cache and install "samba" package
apt:
name: samba
become_user: root
become: yes
- name: Update repositories cache and install "samba-common-bin" package
apt:
name: samba-common-bin
become_user: root
become: yes
- name: Update repositories cache and install "usbmount" package
apt:
name: usbmount
become_user: root
become: yes
- name: Setup Lighttpd /var/www
file:
path: /var/www
owner: www-data
group: www-data
mode: 0755
become_user: root
become: yes
- name: Setup Lighttpd users
user:
name: pi
groups: www-data
append: yes
become_user: root
become: yes
- name: tell Lighttpd to use PHP
command: lighty-enable-mod fastcgi-php userdir
ignore_errors: True
become_user: root
become: yes
- name: Stop Lighttpd
service:
name: lighttpd
state: stopped
become_user: root
become: yes
- name: Start Lighttpd
service:
name: lighttpd
state: started
enabled: yes
become_user: root
become: yes
- name: permissions on /media
file:
path: /media
mode: 0777
owner: pi
group: pi
become_user: root
become: yes
- name: Clean artifact path
file:
path: /var/www/html
name: index.lighttpd.html
state: absent
become_user: root
become: yes
- name: create index.html
lineinfile:
create: yes
state: present
dest: /var/www/html/index.html
line: '<html><meta http-equiv="refresh" content="0; url=media/" /> </html>'
become_user: root
become: yes
- name: link /media to the web interface
file:
src: /media
dest: /var/www/media
state: link
owner: pi
group: pi
become_user: root
become: yes
- name: Copy lighttpd.conf
copy:
src: ./lighttpd.conf
dest: /etc/lighttpd/lighttpd.conf
become_user: root
become: yes
- name: unarchive DirectoryLister
unarchive:
src: DirectoryLister.tar.gz
dest: /media
become_user: root
become: yes
- name: Copy files from config.php
copy:
remote_src: true
src: /media/resources/default.config.php
dest: /media/resources/config.php
- name: Samba 1
lineinfile:
dest: /etc/samba/smb.conf
line: 'wins support = yes'
become_user: root
become: yes
- name: Ansible blockinfile insertafter and insertbefore
blockinfile:
dest: /etc/samba/smb.conf
block: |
[Media]
comment=My media
path = /media
browsable = yes
guest ok = yes
writeable = yes
browseable = yes
public = yes
create mask = 0644
directory mask = 0755
force user = shareuser
become_user: root
become: yes
- name: reload Samba
service:
name: smbd
state: started
become_user: root
become: yes
- name: Config minidlna media_dir=/media
lineinfile:
dest: /etc/minidlna.conf
regexp: '^media_dir='
line: 'media_dir=/media'
state: present
become_user: root
become: yes
- name: Config minidlna media_dir=/media/usb0/music
lineinfile:
dest: /etc/minidlna.conf
insertafter: 'media_dir=.*$'
line: 'media_dir=A,/media/usb0/music'
state: present
become_user: root
become: yes
- name: Config minidlna media_dir=/media/usb0/video
lineinfile:
dest: /etc/minidlna.conf
insertafter: 'media_dir=.*$'
line: 'media_dir=V,/media/usb0/video'
state: present
become_user: root
become: yes
- name: Config minidlna media_dir=/media/usb1/music
lineinfile:
dest: /etc/minidlna.conf
insertafter: 'media_dir=.*$'
line: 'media_dir=A,/media/usb1/music'
state: present
become_user: root
become: yes
- name: Config minidlna media_dir=/media/usb1/video
lineinfile:
dest: /etc/minidlna.conf
insertafter: 'media_dir=.*$'
line: 'media_dir=V,/media/usb1/video'
state: present
become_user: root
become: yes
- name: Config minidlna friendly_name=Mediabox
lineinfile:
dest: /etc/minidlna.conf
regexp: '^friendly_name='
line: 'friendly_name=Mediabox'
state: present
become_user: root
become: yes
- name: Config minidlna inotify=yes
lineinfile:
dest: /etc/minidlna.conf
regexp: '^inotify='
line: 'inotify=yes'
state: present
become_user: root
become: yes
- name: Config minidlna notify_interval=300
lineinfile:
dest: /etc/minidlna.conf
regexp: '^notify_interval='
line: 'notify_interval=300'
state: present
become_user: root
become: yes
- name: minidlna restart
service:
name: minidlna
state: restarted
become_user: root
become: yes
- name: minidlna reload
command: service minidlna force-reload
become_user: root
become: yes
- name: Copy default_footer.php
copy:
src: ./default_footer.php
dest: /media/resources/themes/bootstrap/default_footer.php