Files
server_cloud_ladkau_de/ansible/roles/nextcloud/tasks/main.yml
T
ml b15754ba2f Harden against bot floods and add post-provisioning service check
- 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
2026-06-28 08:02:45 +02:00

50 lines
1.2 KiB
YAML

---
- name: Create Nextcloud data directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: root
group: root
mode: "0755"
loop:
- "{{ nextcloud_data_dir }}"
- "{{ nextcloud_data_dir }}/redis"
tags: nextcloud
# www-data inside the container is UID 33. The html directory must be owned by
# this user so Apache can traverse it and process .htaccess files.
- name: Create Nextcloud html directory (www-data UID 33)
ansible.builtin.file:
path: "{{ nextcloud_data_dir }}/html"
state: directory
owner: "33"
group: "33"
mode: "0755"
tags: nextcloud
- name: Create Nextcloud database directory (postgres UID 999)
ansible.builtin.file:
path: "{{ nextcloud_data_dir }}/db"
state: directory
owner: "999"
group: "999"
mode: "0700"
tags: nextcloud
- name: Deploy Docker Compose file
ansible.builtin.template:
src: docker-compose.yml.j2
dest: "{{ nextcloud_data_dir }}/docker-compose.yml"
owner: root
group: root
mode: "0644"
notify: Restart nextcloud
tags: nextcloud
- name: Start Nextcloud
community.docker.docker_compose_v2:
project_src: "{{ nextcloud_data_dir }}"
state: present
pull: missing
tags: nextcloud