2021-05-20 11:02:47 -04:00
|
|
|
---
|
|
|
|
- hosts: all
|
|
|
|
remote_user: deploy
|
|
|
|
become: yes
|
|
|
|
become_user: root
|
|
|
|
gather_facts: yes
|
|
|
|
tasks:
|
2023-08-17 09:59:10 -04:00
|
|
|
- name: set PVC maintenance mode (legacy)
|
2021-05-20 11:02:47 -04:00
|
|
|
command: pvc maintenance on
|
2021-11-11 15:54:22 -05:00
|
|
|
run_once: yes
|
2023-08-17 09:59:10 -04:00
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: set PVC maintenance mode
|
|
|
|
command: pvc cluster maintenance on
|
|
|
|
run_once: yes
|
|
|
|
ignore_errors: yes
|
2021-05-20 11:02:47 -04:00
|
|
|
|
2021-11-11 15:54:22 -05:00
|
|
|
- hosts: all
|
|
|
|
remote_user: deploy
|
|
|
|
become: yes
|
|
|
|
become_user: root
|
|
|
|
gather_facts: yes
|
|
|
|
serial: 1
|
|
|
|
tasks:
|
2021-05-20 11:02:47 -04:00
|
|
|
- name: install latest PVC packages
|
|
|
|
apt:
|
|
|
|
update_cache: yes
|
|
|
|
autoremove: yes
|
|
|
|
autoclean: yes
|
|
|
|
package:
|
|
|
|
- pvc-client-cli
|
|
|
|
- pvc-daemon-common
|
|
|
|
- pvc-daemon-api
|
|
|
|
- pvc-daemon-node
|
|
|
|
state: latest
|
|
|
|
register: packages
|
|
|
|
|
|
|
|
- name: clean apt archives
|
|
|
|
file:
|
|
|
|
dest: /var/cache/apt/archives
|
|
|
|
state: absent
|
|
|
|
|
2021-07-06 09:30:30 -04:00
|
|
|
- name: restart daemons cleanly
|
2021-05-20 11:02:47 -04:00
|
|
|
block:
|
|
|
|
- name: secondary node
|
|
|
|
command: 'pvc node secondary {{ ansible_hostname }}'
|
|
|
|
ignore_errors: true
|
|
|
|
|
2021-07-06 09:47:06 -04:00
|
|
|
- name: wait 15 seconds for system to stabilize
|
2021-05-20 11:02:47 -04:00
|
|
|
pause:
|
2021-07-06 09:47:06 -04:00
|
|
|
seconds: 15
|
2021-05-20 11:02:47 -04:00
|
|
|
become: no
|
|
|
|
connection: local
|
|
|
|
|
|
|
|
- name: restart PVC daemons
|
|
|
|
service:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: restarted
|
|
|
|
enabled: yes
|
|
|
|
with_items:
|
|
|
|
- pvcapid-worker
|
|
|
|
- pvcnoded
|
|
|
|
|
2021-07-06 09:47:06 -04:00
|
|
|
- name: wait 15 seconds for system to stabilize
|
2021-05-20 11:02:47 -04:00
|
|
|
pause:
|
2021-07-06 09:47:06 -04:00
|
|
|
seconds: 15
|
2021-05-20 11:02:47 -04:00
|
|
|
become: no
|
|
|
|
connection: local
|
|
|
|
|
|
|
|
- name: get service facts
|
|
|
|
service_facts:
|
|
|
|
|
|
|
|
- name: fail if PVC daemons are not running
|
|
|
|
fail:
|
|
|
|
msg: "PVC daemons are not running"
|
|
|
|
when: ansible_facts.services[item] is not defined or ansible_facts.services[item]["state"] != "running"
|
|
|
|
with_items:
|
|
|
|
- pvcnoded.service
|
|
|
|
- pvcapid-worker.service
|
|
|
|
|
|
|
|
- name: reset any systemd failures
|
|
|
|
command: systemctl reset-failed
|
|
|
|
when: packages.changed
|
|
|
|
|
2021-07-06 09:47:06 -04:00
|
|
|
- name: wait 15 seconds for system to stabilize
|
2021-05-20 11:02:47 -04:00
|
|
|
pause:
|
2021-07-06 09:47:06 -04:00
|
|
|
seconds: 15
|
2021-05-20 11:02:47 -04:00
|
|
|
become: no
|
|
|
|
connection: local
|
2021-11-11 15:54:22 -05:00
|
|
|
|
|
|
|
- hosts: all
|
|
|
|
remote_user: deploy
|
|
|
|
become: yes
|
|
|
|
become_user: root
|
|
|
|
gather_facts: yes
|
|
|
|
tasks:
|
|
|
|
- name: unset PVC maintenance mode
|
2023-08-17 09:59:10 -04:00
|
|
|
command: pvc cluster maintenance off
|
2021-11-11 15:54:22 -05:00
|
|
|
run_once: yes
|