Disable nextcloud server in haproxy before updates

This commit is contained in:
Ivan R. 2024-11-29 16:19:28 +05:00
parent 00fa6b31e2
commit aa0ef58ef5
Signed by: lumin
GPG key ID: E0937DC7CD6D3817
2 changed files with 44 additions and 22 deletions

View file

@ -20,29 +20,10 @@
owner: "33"
group: "33"
register: cfg
- name: Run nextcloud container
become: true
community.docker.docker_container:
name: nextcloud-{{ item }}
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
- include_tasks: start_server.yml
loop: [1, 2]
loop_control:
loop_var: server_idx
- name: Schedule background jobs
become: true
ansible.builtin.cron:

View file

@ -0,0 +1,41 @@
---
- 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