b15754ba2f
- Traefik rate-limits all routes (60 req/min standard, 300 for Nextcloud) and writes access logs to /var/log/traefik/access.log - Fail2ban watches Traefik access logs and bans IPs after 10 x 403/404 within 60 s for 24 h - Nextcloud html directory created as www-data (UID 33) so Apache can process .htaccess and serve requests correctly - scripts/check-services.sh verifies all seven endpoints return the expected HTTP status after provisioning
58 lines
1.3 KiB
YAML
58 lines
1.3 KiB
YAML
---
|
|
- name: Create Traefik log directory
|
|
ansible.builtin.file:
|
|
path: /var/log/traefik
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: "0755"
|
|
tags: traefik
|
|
|
|
- name: Create Traefik data directory
|
|
ansible.builtin.file:
|
|
path: "{{ traefik_data_dir }}"
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: "0755"
|
|
tags: traefik
|
|
|
|
# acme.json must be 0600 or Traefik refuses to start
|
|
- name: Create acme.json for certificate storage
|
|
ansible.builtin.file:
|
|
path: "{{ traefik_data_dir }}/acme.json"
|
|
state: touch
|
|
owner: root
|
|
group: root
|
|
mode: "0600"
|
|
modification_time: preserve
|
|
access_time: preserve
|
|
tags: traefik
|
|
|
|
- name: Deploy Traefik static config
|
|
ansible.builtin.template:
|
|
src: traefik.yml.j2
|
|
dest: "{{ traefik_data_dir }}/traefik.yml"
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
notify: Restart traefik
|
|
tags: traefik
|
|
|
|
- name: Deploy Docker Compose file
|
|
ansible.builtin.template:
|
|
src: docker-compose.yml.j2
|
|
dest: "{{ traefik_data_dir }}/docker-compose.yml"
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
notify: Restart traefik
|
|
tags: traefik
|
|
|
|
- name: Start Traefik
|
|
community.docker.docker_compose_v2:
|
|
project_src: "{{ traefik_data_dir }}"
|
|
state: present
|
|
pull: missing
|
|
tags: traefik
|