Use radicale from virtualenv

This commit is contained in:
Sonny Bakker 2021-10-30 20:15:07 +02:00
parent 22ee002aee
commit 55c618ec9c
3 changed files with 45 additions and 5 deletions

View file

@ -1,8 +1,13 @@
- name: create radicale virtualenv directory
file:
path: '{{ ansible_env.HOME }}/.local/share/radicale'
state: directory
- name: install radicale
pip:
name: radicale
state: present
extra_args: --user
virtualenv: '{{ ansible_env.HOME }}/.local/share/radicale/env'
- name: copy radicale password file
become: true
@ -30,14 +35,25 @@
group: root
mode: '0644'
- name: copy radicale template
- name: copy radicale configuration files
become: true
template:
src: 'templates/radicale.j2'
dest: '/etc/radicale/config'
src: '{{ item.src }}'
dest: '{{ item.dest }}'
owner: root
group: root
mode: '0600'
mode: '{{ item.mode }}'
loop:
- {
src: 'templates/radicale/conf.j2',
dest: '/etc/radicale/config',
mode: '0600'
}
- {
src: 'templates/radicale/service.j2',
dest: '/etc/systemd/systemd/radicale.service',
mode: '0644'
}
- name: restart radicale service
become: true
@ -45,3 +61,4 @@
name: radicale
state: restarted
enabled: true
daemon_reload: true

View file

@ -0,0 +1,23 @@
# {{ ansible_managed }} {{ ansible_date_time.time }} {{ ansible_date_time.date }}
[Unit]
Description=A simple CalDAV (calendar) and CardDAV (contact) server
After=network.target
Requires=network.target
[Service]
ExecStart=/home/sonny/.local/share/radicale/env/bin/radicale
Restart=on-failure
UMask=0027
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
PrivateDevices=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectControlGroups=true
NoNewPrivileges=true
ReadWritePaths=/etc/radicale/collections
[Install]
WantedBy=multi-user.target