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 - hosts: all
remote_user: deploy remote_user: deploy
become: yes become: yes
@ -6,9 +16,6 @@
gather_facts: yes gather_facts: yes
serial: 1 serial: 1
tasks: tasks:
- name: set PVC maintenance mode
command: pvc maintenance on
- name: temporarily set norestart policy - name: temporarily set norestart policy
copy: copy:
dest: "/usr/sbin/policy-rc.d" dest: "/usr/sbin/policy-rc.d"
@ -199,11 +206,18 @@
command: systemctl reset-failed command: systemctl reset-failed
when: freshness.changed or kernelversion.changed when: freshness.changed or kernelversion.changed
- name: unset PVC maintenance mode
command: pvc maintenance off
- name: wait 30 seconds for system to stabilize - name: wait 30 seconds for system to stabilize
pause: pause:
seconds: 30 seconds: 30
become: no become: no
connection: local 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 - hosts: all
remote_user: deploy remote_user: deploy
become: yes become: yes
@ -6,9 +16,6 @@
gather_facts: yes gather_facts: yes
serial: 1 serial: 1
tasks: tasks:
- name: set PVC maintenance mode
command: pvc maintenance on
- name: install latest PVC packages - name: install latest PVC packages
apt: apt:
update_cache: yes update_cache: yes
@ -69,11 +76,18 @@
command: systemctl reset-failed command: systemctl reset-failed
when: packages.changed when: packages.changed
- name: unset PVC maintenance mode
command: pvc maintenance off
- name: wait 15 seconds for system to stabilize - name: wait 15 seconds for system to stabilize
pause: pause:
seconds: 15 seconds: 15
become: no become: no
connection: local 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