From 5de3ab0c3af686103ae3b663869a4279533fa46c Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 1 Sep 2023 15:42:28 -0400 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