aboutsummaryrefslogtreecommitdiffstats
path: root/roles/radicale/tasks
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-04-09 15:03:39 +0800
committerAaron LI <aly@aaronly.me>2018-04-09 15:34:58 +0800
commit67dd56ab0d520abf01cdbdbe10b68f6289b6ecc7 (patch)
tree3bebd25c1265c0b6d5fe3f22cad7b70d503180f9 /roles/radicale/tasks
parent40f44a1f486116b8fcae7e307ec1bd82fe433bc6 (diff)
downloadansible-dfly-vps-67dd56ab0d520abf01cdbdbe10b68f6289b6ecc7.tar.bz2
Add radicale role: lightweight {Card,Cal}DAV server
WARNING: py36-radicale2 needs manual installation at the moment.
Diffstat (limited to 'roles/radicale/tasks')
-rw-r--r--roles/radicale/tasks/main.yml65
1 files changed, 65 insertions, 0 deletions
diff --git a/roles/radicale/tasks/main.yml b/roles/radicale/tasks/main.yml
new file mode 100644
index 0000000..dbd6839
--- /dev/null
+++ b/roles/radicale/tasks/main.yml
@@ -0,0 +1,65 @@
+---
+# NOTE: Radicale requires nginx.
+
+- name: install packages
+ pkgng:
+ name: "{{ item }}"
+ state: present
+ with_items:
+ # - py36-radicale2
+ - uwsgi-py36
+
+- name: create data directory
+ file:
+ path: "{{ radicale.home }}"
+ state: directory
+ owner: radicale
+ group: radicale
+ mode: 0700
+
+- 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_socket="/var/run/uwsgi-radicale.sock"
+ uwsgi_radicale_uid="radicale"
+ uwsgi_radicale_gid="radicale"
+ uwsgi_radicale_flags="-L --env RADICALE_CONFIG={{ radicale.etcdir }}/config --plugin python --wsgi-file {{ radicale.wwwdir }}/radicale.wsgi"
+
+- name: enable and start uwsgi
+ command: rcenable uwsgi