Files
ansible/roles/docker/tasks/infrastructure/caddy.yml
T
PhilandClaude Opus 5.5 c0145dd5a2 Harden permissions, close exposed ports, and clean up tasks
- Quote file modes. Unquoted 644/755 were read as decimal, so files
  landed as 1204. Templates holding secrets are now 0640 root:docker.
- Stop publishing Authentik 9000/9443 and Karakeep 3000 (Caddy reaches
  them over the docker network), bind dir2opds to the Tailscale IP, and
  drop Caddy's unused 8448.
- Atuin login uses no_log and only runs once; the installer only runs
  when Atuin is missing.
- Make chsh, ufw-docker install, the bat symlink and Atuin dotfiles
  idempotent.
- Back up the Paperless data volume (SQLite DB), stopping Paperless
  during the backup.
- Close public sign-up on kosync and ByteStash.
- Replace hardcoded IPs and domains with variables.
- Remove teardown tasks and templates for 9 retired services.
- Fix the dockcheck comment: it auto-updates labelled containers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 21:03:54 -06:00

46 lines
1.1 KiB
YAML

- name: make caddy directories
ansible.builtin.file:
path: "{{ item}}"
state: directory
loop:
- /opt/stacks/caddy
- name: Install apache2-utils for htpasswd
ansible.builtin.apt:
name: apache2-utils
state: present
update_cache: true
cache_valid_time: 3600
become: true
when: vault_dir2opds is defined
- name: Generate bcrypt hash for dir2opds basic auth
ansible.builtin.shell: |
htpasswd -bnB "{{ vault_dir2opds.basic_auth_user }}" "{{ vault_dir2opds.basic_auth_password }}" | awk -F: '{print $1, $2}'
register: dir2opds_basic_auth_hash_result
changed_when: false
no_log: true
when: vault_dir2opds is defined
- name: template Caddyfile
ansible.builtin.template:
src: Caddyfile.j2
dest: /opt/stacks/caddy/Caddyfile
owner: root
mode: '0640'
group: docker
notify: restart caddy
- name: template caddy compose file
ansible.builtin.template:
src: caddy-compose.yml.j2
dest: /opt/stacks/caddy/compose.yml
owner: root
mode: '0644'
- name: deploy caddy stack
community.docker.docker_compose_v2:
project_src: /opt/stacks/caddy
recreate: never
files:
- compose.yml