Roles for caddy as well as isso
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Signed-off-by: Nis Wechselberg <enbewe@enbewe.de>
This commit is contained in:
parent
6b7f10a1e1
commit
96a91b2ecb
20 changed files with 696 additions and 0 deletions
64
roles/caddy/tasks/main.yml
Normal file
64
roles/caddy/tasks/main.yml
Normal file
|
@ -0,0 +1,64 @@
|
|||
---
|
||||
- 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'
|
Loading…
Add table
Add a link
Reference in a new issue