blob: 9d436a98e11dd48dabbd6af54a5a630dd08b5732 (
plain)
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
|
- name: Install ikiwiki
apt: pkg={{ packages }}
vars:
packages:
- ikiwiki
- libauthen-passphrase-perl
- highlight-common
- libhighlight-perl
- libimage-magick-perl
- libmail-sendmail-perl
- libnet-dns-sec-perl
- fcgiwrap
- pandoc
- name: Stop and disable fcgiwrap socket
service: name=fcgiwrap.socket state=stopped enabled=false
- name: Stop fcgiwrap service
service: name=fcgiwrap.service state=stopped
- name: Create a user 'ikiwiki'
user: name=ikiwiki system=yes
home=/var/lib/ikiwiki
shell=/usr/sbin/nologin
password=!
state=present
generate_ssh_key=yes
ssh_key_comment=ikiwiki@{{ ansible_fqdn }}
- name: Create directory ~ikiwiki/IkiWiki/Plugin
file: path=/var/lib/ikiwiki/IkiWiki/Plugin
state=directory
owner=ikiwiki group=ikiwiki
mode=0755
- name: Copy ikiwiki plugins
copy: src=var/lib/ikiwiki/IkiWiki/Plugin/{{ item }}.pm
dest=/var/lib/ikiwiki/IkiWiki/Plugin/{{ item }}.pm
owner=root group=root
mode=0644
with_items:
- isWebsite
- pandoc
notify:
- Refresh ikiwiki
# Add the ikiwiki git wrapper as a post-update hook in the git repos in
# gitolite: "config hook.ikiwiki-wrapper = /var/lib/ikiwiki/wiki.fripost.org"
# where the 'git_wrapper' can be found in
# /var/lib/ikiwiki/fripost-wiki.setup
# To create a new wiki:
# $ /usr/bin/sudo -u ikiwiki git config --global user.name "Fripost Admins"
# $ /usr/bin/sudo -u ikiwiki git config --global user.email "admin@fripost.org"
# $ /usr/bin/sudo -u ikiwiki ikiwiki --setup /etc/ikiwiki/auto.setup
# ## Add ikiwiki's key to gitolite
# ## Create post-update hook, cf. http://rtime.felk.cvut.cz/~sojka/blog/using-ikiwiki-with-gitolite/
# $ /usr/bin/sudo -u ikiwiki git clone ssh://gitolite@localhost/fripost-wiki.git
- name: Configure ikiwiki
copy: src=var/lib/ikiwiki/fripost-wiki.setup
dest=/var/lib/ikiwiki/fripost-wiki.setup
owner=root group=root
mode=0644
notify:
- Refresh ikiwiki
- name: Add fripost-wiki to /etc/ikiwiki/wikilist
lineinfile: dest=/etc/ikiwiki/wikilist
line='ikiwiki /var/lib/ikiwiki/fripost-wiki.setup'
owner=root group=root
mode=0644
- meta: flush_handlers
- name: Copy ikiwiki service unit
copy: src=etc/systemd/system/ikiwiki.service
dest=/etc/systemd/system/ikiwiki.service
owner=root group=root
mode=0644
notify:
- systemctl daemon-reload
- Stop ikiwiki
- name: Copy ikiwiki socket unit
copy: src=etc/systemd/system/ikiwiki.socket
dest=/etc/systemd/system/ikiwiki.socket
owner=root group=root
mode=0644
notify:
- systemctl daemon-reload
- Restart ikiwiki
- name: Disable ikiwiki service
service: name=ikiwiki.service enabled=false
- name: Start ikiwiki socket
service: name=ikiwiki.socket state=started enabled=true
- meta: flush_handlers
- name: Copy /etc/nginx/sites-available/{wiki,website}
copy: src=etc/nginx/sites-available/{{ item }}
dest=/etc/nginx/sites-available/{{ item }}
owner=root group=root
mode=0644
register: r1
with_items:
- website
- wiki
notify:
- Restart Nginx
- name: Create /etc/nginx/sites-enabled/{wiki,website}
file: src=../sites-available/{{ item }}
dest=/etc/nginx/sites-enabled/{{ item }}
owner=root group=root
state=link force=yes
register: r2
with_items:
- website
- wiki
notify:
- Restart Nginx
- name: Copy HPKP header snippet
# never modify the pined pubkeys as we don't want to lock out our users
template: src=etc/nginx/snippets/fripost.org.hpkp-hdr.j2
dest=/etc/nginx/snippets/fripost.org.hpkp-hdr
validate=/bin/false
owner=root group=root
mode=0644
register: r3
notify:
- Restart Nginx
- name: Start Nginx
service: name=nginx state=started
when: not (r1.changed or r2.changed or r3.changed)
- meta: flush_handlers
- name: Fetch Nginx's X.509 certificate
# Ensure we don't fetch private data
become: False
fetch_cmd: cmd="openssl x509 -noout -pubkey"
stdin=/etc/nginx/ssl/www.fripost.org.pem
dest=certs/public/fripost.org.pub
tags:
- genkey
- name: Create directory /var/www/fripost.org/autoconfig/mail
file: path=/var/www/fripost.org/autoconfig/mail
state=directory
owner=root group=root
mode=0755
- name: Copy /var/www/fripost.org/autoconfig/mail/config-v1.1.xml
copy: src=var/www/fripost.org/autoconfig/mail/config-v1.1.xml
dest=/var/www/fripost.org/autoconfig/mail/config-v1.1.xml
owner=root group=root
mode=0644
|