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
radicale_user: radicale
radicale_root_path: /srv/radicale
radicale_auth_type: ""

View File

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

View File

@ -2,24 +2,33 @@
# tasks file for radicale
- name: Installer les prérequis
ansible.builtin.package:
name: python3-pip
ansible.builtin.apt:
state: latest
name: pipx
become: true
- name: Installer le paquet via pip
ansible.builtin.pip:
name: radicale
- name: Installer le paquet
community.general.pipx:
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
notify: Redémarrer radicale.service
- name: Créer l'emplacement de stockage
ansible.builtin.file:
path: "{{ radicale_root_path }}"
state: directory
owner: radicale
group: radicale
owner: "{{ radicale_user }}"
group: "{{ radicale_user }}"
mode: u=rwX,g=rX,o=
become: true
@ -36,7 +45,7 @@
- name: Déployer la configuration
ansible.builtin.template:
owner: root
group: radicale
group: "{{ radicale_user }}"
mode: u=rw,g=r,o=
src: radicale.conf.j2
dest: "{{ radicale_root_path }}/radicale.conf"

View File

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