1
0
Fork 0
ansible-collection-caddy/roles/caddy/tasks/main.yml
Nis Wechselberg 96a91b2ecb
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Roles for caddy as well as isso
Signed-off-by: Nis Wechselberg <enbewe@enbewe.de>
2025-05-07 21:37:12 +02:00

64 lines
1.4 KiB
YAML

---
- name: 'Ensure required software is installed'
become: true
ansible.builtin.apt:
name: 'podman'
state: 'present'
- name: 'Define caddy image'
become: true
containers.podman.podman_image:
name: '{{ caddy_podman_image_name }}:{{ caddy_podman_image_tag }}'
state: 'quadlet'
notify:
- 'Reload caddy services'
- 'Restart caddy image'
- name: 'Define caddy data volume'
become: true
containers.podman.podman_volume:
name: 'caddy-data'
state: 'quadlet'
notify:
- 'Reload caddy services'
- 'Restart caddy volume'
- name: 'Create caddy conf directory'
become: true
ansible.builtin.file:
name: '{{ caddy_conf_path }}'
state: 'directory'
owner: 'root'
group: 'root'
mode: 'u=rwx,g=rx,o=rx'
- name: 'Generate Caddyfile'
become: true
ansible.builtin.template:
src: 'Caddyfile.j2'
dest: '{{ caddy_conf_path }}/Caddyfile'
owner: 'root'
group: 'root'
mode: 'u=rw,g=r,o=r'
notify:
- 'Restart caddy container'
- name: 'Create caddy container'
become: true
containers.podman.podman_container:
name: 'caddy'
image: 'caddy.image'
network: '{{ caddy_networks }}'
state: 'quadlet'
volume:
- '{{ caddy_conf_path }}:/etc/caddy'
- 'caddy-data.volume:/data'
publish:
- '80:80'
- '443:443'
quadlet_options: |
[Install]
WantedBy=default.target
notify:
- 'Reload caddy services'
- 'Restart caddy container'