Disable nextcloud server in haproxy before updates
This commit is contained in:
parent
00fa6b31e2
commit
aa0ef58ef5
2 changed files with 44 additions and 22 deletions
|
@ -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:
|
||||
|
|
41
roles/nextcloud/tasks/start_server.yml
Normal file
41
roles/nextcloud/tasks/start_server.yml
Normal 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
|
Loading…
Reference in a new issue