refactor: Use pipx to install radicale

This commit is contained in:
pulsar89.5 2024-06-27 18:51:29 +02:00
parent 7df3eedad1
commit 0c228a22f4
4 changed files with 21 additions and 20 deletions

View File

@ -1,6 +1,6 @@
--- ---
# defaults file for radicale # defaults file for radicale
radicale_user: radicale
radicale_root_path: /srv/radicale radicale_root_path: /srv/radicale
radicale_auth_type: "" radicale_auth_type: ""

View File

@ -12,12 +12,4 @@ galaxy_info:
versions: versions:
- all - all
dependencies: dependencies: []
- role: users
vars:
users_role_radicale:
- name: radicale
comment: "Dedicated user for radicale"
update_password: on_create
password_lock: true
shell: /sbin/nologin

View File

@ -2,24 +2,33 @@
# tasks file for radicale # tasks file for radicale
- name: Installer les prérequis - name: Installer les prérequis
ansible.builtin.package: ansible.builtin.apt:
name: python3-pip
state: latest state: latest
name: pipx
become: true become: true
- name: Installer le paquet via pip - name: Installer le paquet
ansible.builtin.pip: community.general.pipx:
name: radicale
state: latest state: latest
name: radicale
install_deps: true
include_injected: true
become: true
environment:
PIPX_HOME: /opt/pipx
PIPX_BIN_DIR: /usr/local/bin
- name: S'assurer que les exécutables sont inclus dans le path
ansible.builtin.command:
cmd: pipx ensurepath
become: true become: true
notify: Redémarrer radicale.service
- name: Créer l'emplacement de stockage - name: Créer l'emplacement de stockage
ansible.builtin.file: ansible.builtin.file:
path: "{{ radicale_root_path }}" path: "{{ radicale_root_path }}"
state: directory state: directory
owner: radicale owner: "{{ radicale_user }}"
group: radicale group: "{{ radicale_user }}"
mode: u=rwX,g=rX,o= mode: u=rwX,g=rX,o=
become: true become: true
@ -36,7 +45,7 @@
- name: Déployer la configuration - name: Déployer la configuration
ansible.builtin.template: ansible.builtin.template:
owner: root owner: root
group: radicale group: "{{ radicale_user }}"
mode: u=rw,g=r,o= mode: u=rw,g=r,o=
src: radicale.conf.j2 src: radicale.conf.j2
dest: "{{ radicale_root_path }}/radicale.conf" dest: "{{ radicale_root_path }}/radicale.conf"

View File

@ -7,7 +7,7 @@ Requires=network.target
[Service] [Service]
Environment="RADICALE_CONFIG={{ radicale_root_path }}/radicale.conf" Environment="RADICALE_CONFIG={{ radicale_root_path }}/radicale.conf"
ExecStart=/usr/bin/env python3 -m radicale ExecStart=/usr/local/bin/radicale
Restart=on-failure Restart=on-failure
User=radicale User=radicale
# Deny other users access to the calendar data # Deny other users access to the calendar data