-
Notifications
You must be signed in to change notification settings - Fork 3
/
provision.yaml
73 lines (65 loc) · 2.59 KB
/
provision.yaml
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
---
- name: Provision Library nodes with Dark Web access if requested.
hosts: all
become: true
pre_tasks:
- name: Register firewall configuration.
import_tasks: tasks/configure-firewall.yaml
# If OnionShare is requested, run this before the Common role.
# This is because we will probably also want a disk quota and
# thus need to have the OnionShare OS user account exist first.
- name: OnionShare first.
when:
- onionshare_receiver_mode | default(false)
import_role:
name: onionshare
roles:
- common
- calibre
- lighttpd
# Run the Tor role for a Tor server that's NOT also an OnionShare
# receiver; OnionShare receiving servers enact Tor automatically.
- role: tor
when:
- tor_onion_service_server | default(false)
- not onionshare_receiver_mode | default(false)
tasks:
- name: Install Calibre Content server resources.
when: calibre_server_resources_files is defined
copy:
src: "{{ calibre_server_resources_files }}/content_server"
dest: "{{ calibre_server_home_dir }}/.config/calibre/resources/"
owner: "{{ calibre_server_username }}"
notify: Restart Calibre.
- name: Create Web landing page.
when: web_landing_page_resources_dir is defined
block:
- name: Install Web landing page files.
ignore_errors: true # It's possible we have no files to copy. :)
synchronize:
src: "files/{{ web_landing_page_resources_dir }}/"
dest: /var/www/html/
rsync_opts:
- "--exclude=.git"
- "--chown={{ lighttpd_server_username }}:{{ lighttpd_server_username }}"
- "--chmod=D555,F444"
# FIXME: Why does the `rsync` command always return changed?
changed_when: false
- name: Ensure Web landing page directory structure exists.
when: item.state == "directory"
file:
path: "/var/www/html/{{ item.path }}"
state: directory
owner: "{{ lighttpd_server_username }}"
group: "{{ lighttpd_server_username }}"
mode: "555"
with_filetree: "templates/{{ web_landing_page_resources_dir }}"
- name: Write Web landing page templates.
when: item.state == "file"
template:
src: "{{ item.src }}"
dest: "/var/www/html/{{ item.path }}"
owner: "{{ lighttpd_server_username }}"
group: "{{ lighttpd_server_username }}"
mode: "444"
with_filetree: "templates/{{ web_landing_page_resources_dir }}"