homelab/roles/nextcloud/tasks/start_server.yml

41 lines
1.1 KiB
YAML

---
- name: Disable server in haproxy
become: true
community.general.haproxy:
socket: /run/haproxy/admin.sock
state: disabled
drain: true
wait: true
backend: nextcloud
host: s{{ server_idx }}
fail_on_not_found: true
- name: Run nextcloud container
become: true
community.docker.docker_container:
name: nextcloud-{{ server_idx }}
image: nextcloud:30.0.2-apache
networks:
- name: nextcloud
- name: haproxy
- name: postgresql
volumes:
- nextcloud:/var/www/html
- /mnt/hdd/nextcloud/data:/var/www/html/data
recreate: "{{ cfg.changed }}"
restart_policy: unless-stopped
healthcheck:
test: ["CMD", "curl", "--fail", "http://127.0.0.1/status.php"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
# TODO: enable after ansible update
# state: healthy
- name: Enable server in haproxy
become: true
community.general.haproxy:
socket: /run/haproxy/admin.sock
state: enabled
backend: nextcloud
host: s{{ server_idx }}
fail_on_not_found: true