--- # 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