Move pvc maintenance to separate plays

This ensures that the maintenance on/off happens before all tasks and
after all tasks and not intermittently.
This commit is contained in:
Joshua Boniface 2021-11-11 15:54:22 -05:00
parent fed71d7add
commit 70c7c76605
2 changed files with 40 additions and 12 deletions

View File

@ -1,4 +1,14 @@
---
- hosts: all
remote_user: deploy
become: yes
become_user: root
gather_facts: yes
tasks:
- name: set PVC maintenance mode
command: pvc maintenance on
run_once: yes
- hosts: all
remote_user: deploy
become: yes
@ -6,9 +16,6 @@
gather_facts: yes
serial: 1
tasks:
- name: set PVC maintenance mode
command: pvc maintenance on
- name: temporarily set norestart policy
copy:
dest: "/usr/sbin/policy-rc.d"
@ -199,11 +206,18 @@
command: systemctl reset-failed
when: freshness.changed or kernelversion.changed
- name: unset PVC maintenance mode
command: pvc maintenance off
- name: wait 30 seconds for system to stabilize
pause:
seconds: 30
become: no
connection: local
- hosts: all
remote_user: deploy
become: yes
become_user: root
gather_facts: yes
tasks:
- name: unset PVC maintenance mode
command: pvc maintenance off
run_once: yes

View File

@ -1,4 +1,14 @@
---
- hosts: all
remote_user: deploy
become: yes
become_user: root
gather_facts: yes
tasks:
- name: set PVC maintenance mode
command: pvc maintenance on
run_once: yes
- hosts: all
remote_user: deploy
become: yes
@ -6,9 +16,6 @@
gather_facts: yes
serial: 1
tasks:
- name: set PVC maintenance mode
command: pvc maintenance on
- name: install latest PVC packages
apt:
update_cache: yes
@ -69,11 +76,18 @@
command: systemctl reset-failed
when: packages.changed
- name: unset PVC maintenance mode
command: pvc maintenance off
- name: wait 15 seconds for system to stabilize
pause:
seconds: 15
become: no
connection: local
- hosts: all
remote_user: deploy
become: yes
become_user: root
gather_facts: yes
tasks:
- name: unset PVC maintenance mode
command: pvc maintenance off
run_once: yes