--- - name: Install Caddy ansible.builtin.package: name: caddy state: present - name: Update Caddyfile ansible.builtin.copy: src: Caddyfile dest: /etc/caddy/Caddyfile mode: "644" - name: Create site config directories ansible.builtin.file: path: "{{ item }}" state: directory mode: "755" with_items: - /etc/caddy/sites-available - /etc/caddy/sites-enabled - /var/log/caddy - name: Configure logging dir ansible.builtin.file: path: "{{ item }}" state: directory owner: caddy group: caddy mode: "755" with_items: - /var/log/caddy - name: Enable and start the Caddy server ansible.builtin.service: name: caddy.service enabled: true state: started - name: Configure nftables ansible.builtin.copy: dest: /etc/nftables/input.d/caddy.nft src: caddy.nft mode: "644" when: firewall is defined notify: Restart nftables