This repository has been archived on 2023-12-29. You can view files and clone it, but cannot push or open issues or pull requests.
pi-ansible/roles/docker/tasks/services/caddy.yml

42 lines
969 B
YAML
Raw Normal View History

2022-12-22 19:18:27 +00:00
# vim: ft=yaml.ansible
2022-12-22 16:58:48 +00:00
---
- name: Create Caddy volume directories
file:
name: "{{ services.caddy.volume }}/{{ dir }}"
2022-12-23 14:54:29 +00:00
owner: root
2022-12-22 16:58:48 +00:00
mode: u=rwx,g=rx,o=rx
state: directory
loop:
- config
- data
loop_control:
loop_var: dir
- name: Copy Caddyfile
template:
src: Caddyfile.j2
dest: "{{ services.caddy.volume }}/Caddyfile"
2022-12-23 14:54:29 +00:00
owner: root
2022-12-22 16:58:48 +00:00
mode: u=rw,g=r,o=r
- name: Deploy Caddy Docker container
docker_container:
name: caddy
2023-01-03 21:30:22 +00:00
image: caddy:{{ services.caddy.version }}
2022-12-22 16:58:48 +00:00
restart_policy: unless-stopped
networks:
2022-12-28 17:03:57 +00:00
- name: services
2022-12-28 17:24:27 +00:00
ipv4_address: 172.16.0.2
published_ports:
2023-01-03 21:30:22 +00:00
- 80:80/tcp
- 443:443/tcp
2022-12-22 16:58:48 +00:00
volumes:
- "{{ services.caddy.volume }}/Caddyfile:/etc/caddy/Caddyfile:ro"
- "{{ services.caddy.volume }}/config:/config:rw"
- "{{ services.caddy.volume }}/data:/data:rw"
capabilities:
- net_bind_service
- dac_override
cap_drop:
- all