blob: c70658df859c6e96df4bac4ac0b5c0a2942c5a9c (
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
|
---
# NOTE: Radicale requires nginx.
- name: install packages
pkgng:
name:
- py36-radicale2
- uwsgi
state: present
- name: create data directory
file:
path: "{{ radicale.home }}"
state: directory
owner: radicale
group: radicale
mode: 0700
- name: initialize git repo
become_user: radicale
command: git init
args:
chdir: "{{ radicale.home }}"
creates: "{{ radicale.home }}/.git"
when: radicale.git
- name: config git user name
become_user: radicale
command: git config user.name Radicale
args:
chdir: "{{ radicale.home }}"
when: radicale.git
- name: config git user email
become_user: radicale
command: git config user.email radicale@localhost
args:
chdir: "{{ radicale.home }}"
when: radicale.git
- name: generate config file
template:
src: config.j2
dest: "{{ radicale.etcdir }}/config"
notify: reload-radicale
- name: copy extra config files
copy:
src: "{{ item }}"
dest: "{{ radicale.etcdir }}/{{ item | basename }}"
with_items:
- logging
- rights
notify: reload-radicale
- name: copy gitignore for storage
copy:
src: _gitignore
dest: "{{ radicale.home }}/.gitignore"
- name: create nginx auth/ dirctory
file:
path: /usr/local/etc/nginx/auth
state: directory
- name: generate passwd for nginx
template:
src: radicale.passwd.j2
dest: /usr/local/etc/nginx/auth/radicale.passwd
group: www
mode: 0440
notify: reload-nginx
- name: setup uwsgi in rc.conf
blockinfile:
path: /etc/rc.conf
marker: "# {mark} ANSIBLE MANAGED - uwsgi/radicale"
block: |
uwsgi_profiles="${uwsgi_profiles} radicale"
uwsgi_radicale_uid="radicale"
uwsgi_radicale_gid="radicale"
uwsgi_radicale_socket_owner="radicale:www"
uwsgi_radicale_flags="-L --log-reopen --logfile-chown --wsgi-file {{ radicale.wwwdir }}/radicale.wsgi --env RADICALE_CONFIG={{ radicale.etcdir }}/config"
- name: enable and start uwsgi
command: rcenable uwsgi
- name: start radicale
command: service uwsgi start radicale
|