From 03ed9e111c43816954919ba08b6ec0b6c5ef3e9c Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Tue, 3 Aug 2021 11:58:49 -0400 Subject: [PATCH] infra: use dedicated variables for balancer status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The balancer status is registered during the cephadm-adopt, rolling_update and swith2container playbooks. But it is also used in the ceph-handler role which is included in those playbooks too. Even if the ceph-handler tasks are skipped for rolling_update and switch2container, the balancer_status variable is erased with the skip task result. play1: register: balancer_status play2: register: balancer_status <-- skipped play3: when: (balancer_status.stdout | from_json)['active'] | bool This leads to issue like: The conditional check '(balancer_status.stdout | from_json)['active'] | bool' failed. The error was: Unexpected templating type error occurred on ({% if (balancer_status.stdout | from_json)['active'] | bool %} True {% else %} False {% endif %}): expected string or buffer. Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1982054 Signed-off-by: Dimitri Savineau (cherry picked from commit 386661699bcfe05a220de6d58b9d50baa7eb6dc1) --- infrastructure-playbooks/rolling_update.yml | 6 +++--- ...from-non-containerized-to-containerized-ceph-daemons.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/infrastructure-playbooks/rolling_update.yml b/infrastructure-playbooks/rolling_update.yml index bbe783c619..ed11ed1549 100644 --- a/infrastructure-playbooks/rolling_update.yml +++ b/infrastructure-playbooks/rolling_update.yml @@ -419,7 +419,7 @@ - name: get balancer module status command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer status -f json" - register: balancer_status + register: balancer_status_update changed_when: false check_mode: false @@ -431,7 +431,7 @@ - name: disable balancer command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer off" changed_when: false - when: (balancer_status.stdout | from_json)['active'] | bool + when: (balancer_status_update.stdout | from_json)['active'] | bool - name: disable pg autoscale on pools command: "{{ ceph_cmd }} --cluster {{ cluster }} osd pool set {{ item.name }} pg_autoscale_mode off" @@ -569,7 +569,7 @@ - name: re-enable balancer command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer on" changed_when: false - when: (balancer_status.stdout | from_json)['active'] | bool + when: (balancer_status_update.stdout | from_json)['active'] | bool - name: set_fact container_exec_cmd_osd set_fact: diff --git a/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml b/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml index d7e8d48b72..46e30c5b8c 100644 --- a/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml +++ b/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml @@ -222,7 +222,7 @@ - name: get balancer module status command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer status -f json" - register: balancer_status + register: balancer_status_switch changed_when: false check_mode: false @@ -234,7 +234,7 @@ - name: disable balancer command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer off" changed_when: false - when: (balancer_status.stdout | from_json)['active'] | bool + when: (balancer_status_switch.stdout | from_json)['active'] | bool - name: disable pg autoscale on pools command: "{{ ceph_cmd }} --cluster {{ cluster }} osd pool set {{ item.name }} pg_autoscale_mode off" @@ -423,7 +423,7 @@ - name: re-enable balancer command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer on" changed_when: false - when: (balancer_status.stdout | from_json)['active'] | bool + when: (balancer_status_switch.stdout | from_json)['active'] | bool - name: switching from non-containerized to containerized ceph mds