No description
Find a file
2025-11-01 17:38:51 +00:00
defaults add hook to enable socket proxy tasks, move auth to simply detect user and passwd 2025-11-01 17:38:51 +00:00
files update common format, add system socket templates 2025-10-06 22:05:38 +00:00
meta update image value name, update galaxy description, update task names 2024-12-18 23:50:58 +00:00
tasks add hook to enable socket proxy tasks, move auth to simply detect user and passwd 2025-11-01 17:38:51 +00:00
templates add hook to enable socket proxy tasks, move auth to simply detect user and passwd 2025-11-01 17:38:51 +00:00
.gitignore update common format, add system socket templates 2025-10-06 22:05:38 +00:00
README.md update readme example 2024-12-19 00:18:39 +00:00

ansible-roles-caddy

This role is designed to provide a reverse proxy in conjuction with another role based deployment such as a metrics stack

Task Configuration

- name: Setup caddy
  hosts: somehost
  become: true
  roles:
    - role: caddy
      caddy_sites:
        - name: some-test
          url: somehost.com
          srv: "{{ caddy_local_address }}:8080"
    - role: firewalld
      firewalld_services:
        - http
        - https
      firewalld_forwards:
        - port: 80
          to: 8080
        - port: 443
          to: 8443
        - port: 443
          to: 8443
          proto: udp

Current configuration generates a single dynamic config file, this could be reconfigured to read from a directory

caddy-static.yml.j2

providers:
  providersThrottleDuration: 2s
  file:
    directory: /etc/caddy/dynamic
    watch: {{ caddy_watch }}

Deployment and Removal

Sometimes you need to manually stop the running containers to get a clean run when re-deploying Services must be stopped as the respecitve user or another means to aquire the correct user scope for systemd

systemctl --user stop container-caddy.service

Deploy

ansible-playbook -i hosts site.yml --tags=firewalld,caddy --limit=somehost

Remove

ansible-playbook -i hosts site.yml --tags=firewalld,caddy --extra-vars "container_state=absent firewall_action=remove" --limit=somehost