| 1 | --- |
| 2 | # SPDX-License-Identifier: AGPL-3.0-or-later |
| 3 | - name: Caddy — install (apt repo) |
| 4 | shell: | |
| 5 | if ! command -v caddy >/dev/null; then |
| 6 | apt -y install debian-keyring debian-archive-keyring apt-transport-https |
| 7 | curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' \ |
| 8 | | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg |
| 9 | curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' \ |
| 10 | | tee /etc/apt/sources.list.d/caddy-stable.list |
| 11 | apt update && apt -y install caddy |
| 12 | fi |
| 13 | args: |
| 14 | creates: /usr/bin/caddy |
| 15 | |
| 16 | - name: Caddyfile — render |
| 17 | template: |
| 18 | src: "{{ playbook_dir }}/../Caddyfile.j2" |
| 19 | dest: /etc/caddy/Caddyfile |
| 20 | mode: "0644" |
| 21 | notify: reload caddy |
| 22 | |
| 23 | - name: Caddy — enabled + started |
| 24 | systemd: { name: caddy, state: started, enabled: yes } |
| 25 |