initial commit
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
commit
75891c3271
129 changed files with 8046 additions and 0 deletions
2
roles/radicale/defaults/main.yml
Normal file
2
roles/radicale/defaults/main.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
radicale_version: "latest"
|
||||
radicale_port: 5232
|
||||
7
roles/radicale/handlers/main.yml
Normal file
7
roles/radicale/handlers/main.yml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: restart radicale
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: /srv/radicale
|
||||
state: present
|
||||
recreate: always
|
||||
build: never
|
||||
81
roles/radicale/tasks/main.yml
Normal file
81
roles/radicale/tasks/main.yml
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
---
|
||||
- name: Create radicale directories
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
loop:
|
||||
- /srv/radicale
|
||||
- /srv/radicale/data
|
||||
- /srv/radicale/config
|
||||
|
||||
- name: Create radicale configuration
|
||||
template:
|
||||
src: config.j2
|
||||
dest: /srv/radicale/config/config
|
||||
mode: '0644'
|
||||
notify: restart radicale
|
||||
|
||||
- name: Check for cached radicale hash
|
||||
ansible.builtin.stat:
|
||||
path: /srv/radicale/config/.radicale_hash
|
||||
register: _radicale_hash_stat
|
||||
|
||||
- name: Read radicale hash from cache
|
||||
ansible.builtin.slurp:
|
||||
src: /srv/radicale/config/.radicale_hash
|
||||
register: _radicale_hash_file
|
||||
when: _radicale_hash_stat.stat.exists
|
||||
|
||||
- name: Set radicale hash fact from cache
|
||||
ansible.builtin.set_fact:
|
||||
_radicale_hash: "{{ _radicale_hash_file.content | b64decode | trim }}"
|
||||
when: _radicale_hash_stat.stat.exists
|
||||
|
||||
- name: Generate radicale password hash
|
||||
command:
|
||||
argv:
|
||||
- docker
|
||||
- run
|
||||
- --rm
|
||||
- caddy:2
|
||||
- caddy
|
||||
- hash-password
|
||||
- --plaintext
|
||||
- "{{ radicale_password }}"
|
||||
register: _radicale_hash_result
|
||||
changed_when: false
|
||||
no_log: true
|
||||
when: not _radicale_hash_stat.stat.exists
|
||||
|
||||
- name: Cache radicale hash
|
||||
ansible.builtin.copy:
|
||||
content: "{{ _radicale_hash_result.stdout }}"
|
||||
dest: /srv/radicale/config/.radicale_hash
|
||||
mode: "0600"
|
||||
when: not _radicale_hash_stat.stat.exists
|
||||
|
||||
- name: Set radicale hash fact from generation
|
||||
ansible.builtin.set_fact:
|
||||
_radicale_hash: "{{ _radicale_hash_result.stdout }}"
|
||||
when: not _radicale_hash_stat.stat.exists
|
||||
|
||||
- name: Create radicale users file
|
||||
copy:
|
||||
content: "{{ admin_user }}:{{ _radicale_hash }}"
|
||||
dest: /srv/radicale/config/users
|
||||
mode: '0644'
|
||||
notify: restart radicale
|
||||
|
||||
- name: Create compose file
|
||||
template:
|
||||
src: compose.yml.j2
|
||||
dest: /srv/radicale/compose.yml
|
||||
mode: '0644'
|
||||
notify: restart radicale
|
||||
|
||||
- name: Deploy radicale
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: /srv/radicale
|
||||
state: present
|
||||
build: never
|
||||
17
roles/radicale/templates/compose.yml.j2
Normal file
17
roles/radicale/templates/compose.yml.j2
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
services:
|
||||
radicale:
|
||||
image: tomsquest/docker-radicale:{{ radicale_version }}
|
||||
container_name: radicale
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- /srv/radicale/data:/data
|
||||
- /srv/radicale/config:/config:ro
|
||||
networks:
|
||||
- radicale
|
||||
- monitoring
|
||||
|
||||
networks:
|
||||
radicale:
|
||||
external: true
|
||||
monitoring:
|
||||
external: true
|
||||
10
roles/radicale/templates/config.j2
Normal file
10
roles/radicale/templates/config.j2
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[server]
|
||||
hosts = 0.0.0.0:{{ radicale_port }}
|
||||
|
||||
[auth]
|
||||
type = htpasswd
|
||||
htpasswd_filename = /config/users
|
||||
htpasswd_encryption = bcrypt
|
||||
|
||||
[storage]
|
||||
filesystem_folder = /data/collections
|
||||
Loading…
Add table
Add a link
Reference in a new issue