From 70c7c76605043a7c8a0f846881ffefc2248fa212 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Thu, 11 Nov 2021 15:54:22 -0500 Subject: [PATCH] Move pvc maintenance to separate plays This ensures that the maintenance on/off happens before all tasks and after all tasks and not intermittently. --- oneshot/update-pvc-cluster.yml | 26 ++++++++++++++++++++------ oneshot/update-pvc-daemons.yml | 26 ++++++++++++++++++++------ 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/oneshot/update-pvc-cluster.yml b/oneshot/update-pvc-cluster.yml index 337a89c..9cb50b0 100644 --- a/oneshot/update-pvc-cluster.yml +++ b/oneshot/update-pvc-cluster.yml @@ -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 diff --git a/oneshot/update-pvc-daemons.yml b/oneshot/update-pvc-daemons.yml index 75ee680..5499971 100644 --- a/oneshot/update-pvc-daemons.yml +++ b/oneshot/update-pvc-daemons.yml @@ -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