From 12d6fecb7550bdae1e1615bf359849296649c08a Mon Sep 17 00:00:00 2001 From: Francesco Pantano Date: Wed, 30 Mar 2022 17:07:36 +0200 Subject: [PATCH] Explicitly cast boolean variables in cephadm playbook Depending on the ansible config it might happen that variables are evaluated as string, resulting in a wrong tasks order execution. This patch just cast to bool the global variables that drive the cephadm playbook execution during the overcloud deployment stage. Change-Id: Iad553cd115c4486b4215d4f8dcf4ffd74d8d1ccb --- tripleo_ansible/playbooks/cephadm.yml | 8 ++++---- .../roles/tripleo_cephadm/tasks/apply_spec.yaml | 4 ++-- .../roles/tripleo_cephadm/tasks/bootstrap.yaml | 4 ++-- .../tripleo_cephadm/tasks/cephadm_config_set.yaml | 10 +++++----- .../tasks/dashboard/configure_dashboard_backends.yml | 2 +- .../roles/tripleo_cephadm/tasks/export.yaml | 2 +- tripleo_ansible/roles/tripleo_cephadm/tasks/post.yaml | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tripleo_ansible/playbooks/cephadm.yml b/tripleo_ansible/playbooks/cephadm.yml index d421f7a86..4e5a59f7e 100644 --- a/tripleo_ansible/playbooks/cephadm.yml +++ b/tripleo_ansible/playbooks/cephadm.yml @@ -26,22 +26,22 @@ name: tripleo_cephadm tasks_from: bootstrap when: - - not tripleo_cephadm_deployed_ceph + - not tripleo_cephadm_deployed_ceph | bool - name: Apply ceph_conf_overrides on update import_role: name: tripleo_cephadm tasks_from: apply_ceph_conf_overrides when: - - tripleo_cephadm_apply_ceph_conf_overrides_on_update + - tripleo_cephadm_apply_ceph_conf_overrides_on_update | bool - name: Apply Ceph spec import_role: name: tripleo_cephadm tasks_from: apply_spec when: - - not tripleo_cephadm_spec_on_bootstrap - - not tripleo_cephadm_deployed_ceph + - not tripleo_cephadm_spec_on_bootstrap | bool + - not tripleo_cephadm_deployed_ceph | bool - name: Set crush rules if provided import_role: diff --git a/tripleo_ansible/roles/tripleo_cephadm/tasks/apply_spec.yaml b/tripleo_ansible/roles/tripleo_cephadm/tasks/apply_spec.yaml index 3e630f22a..14817628f 100644 --- a/tripleo_ansible/roles/tripleo_cephadm/tasks/apply_spec.yaml +++ b/tripleo_ansible/roles/tripleo_cephadm/tasks/apply_spec.yaml @@ -55,8 +55,8 @@ - name: Show results of spec apply debug: msg: "{{ tripleo_cephadm_apply_spec_out }}" - when: tripleo_cephadm_verbose + when: tripleo_cephadm_verbose | bool - name: Wait for the expected number of osds to be running include_tasks: wait_for_expected_num_osds.yaml - when: tripleo_cephadm_wait_for_osds + when: tripleo_cephadm_wait_for_osds | bool diff --git a/tripleo_ansible/roles/tripleo_cephadm/tasks/bootstrap.yaml b/tripleo_ansible/roles/tripleo_cephadm/tasks/bootstrap.yaml index 2695b6be9..ea9fe5547 100644 --- a/tripleo_ansible/roles/tripleo_cephadm/tasks/bootstrap.yaml +++ b/tripleo_ansible/roles/tripleo_cephadm/tasks/bootstrap.yaml @@ -17,7 +17,7 @@ - name: Add spec to necessary file list when using spec to bootstrap set_fact: tripleo_cephadm_bootstrap_files: "{{ tripleo_cephadm_bootstrap_files + [ tripleo_cephadm_spec ] }}" - when: tripleo_cephadm_spec_on_bootstrap + when: tripleo_cephadm_spec_on_bootstrap | bool - name: Stat necessary files to bootstrap with cephadm stat: @@ -69,7 +69,7 @@ - name: Show results of bootstrap debug: msg: "{{ cephadm_bootstrap }}" - when: tripleo_cephadm_verbose + when: tripleo_cephadm_verbose | bool when: - cephadm_ls is defined - cephadm_ls.stdout == '[]' diff --git a/tripleo_ansible/roles/tripleo_cephadm/tasks/cephadm_config_set.yaml b/tripleo_ansible/roles/tripleo_cephadm/tasks/cephadm_config_set.yaml index e4e765dd3..c5b20ece5 100644 --- a/tripleo_ansible/roles/tripleo_cephadm/tasks/cephadm_config_set.yaml +++ b/tripleo_ansible/roles/tripleo_cephadm/tasks/cephadm_config_set.yaml @@ -19,7 +19,7 @@ {{ tripleo_cephadm_ceph_cli }} config set mgr mgr/cephadm/log_to_cluster_level debug changed_when: false become: true - when: tripleo_cephadm_debug + when: tripleo_cephadm_debug | bool - name: set default container image in ceph configuration command: | @@ -28,7 +28,7 @@ changed_when: false become: true when: - - not (tripleo_cephadm_default_container | default(false)) + - not (tripleo_cephadm_default_container | default(false) | bool) - name: enforce minimum ceph clients version command: | @@ -47,12 +47,12 @@ changed_when: false become: true when: - - not (tripleo_cephadm_default_container | default(false)) + - not (tripleo_cephadm_default_container | default(false) | bool) - name: set dashboard container image in ceph mgr configuration when: - tripleo_cephadm_dashboard_enabled | bool - - not (tripleo_cephadm_default_container | default(false)) + - not (tripleo_cephadm_default_container | default(false) | bool) become: true block: - name: set alertmanager container image in ceph configuration @@ -83,7 +83,7 @@ when: - tripleo_cephadm_haproxy_container_image is defined - tripleo_cephadm_keepalived_container_image is defined - - not (tripleo_cephadm_default_container | default(false)) + - not (tripleo_cephadm_default_container | default(false) | bool) become: true block: - name: set haproxy container image in ceph configuration diff --git a/tripleo_ansible/roles/tripleo_cephadm/tasks/dashboard/configure_dashboard_backends.yml b/tripleo_ansible/roles/tripleo_cephadm/tasks/dashboard/configure_dashboard_backends.yml index dc083e42a..1c0167472 100644 --- a/tripleo_ansible/roles/tripleo_cephadm/tasks/dashboard/configure_dashboard_backends.yml +++ b/tripleo_ansible/roles/tripleo_cephadm/tasks/dashboard/configure_dashboard_backends.yml @@ -24,7 +24,7 @@ - name: Check the resulting mgr container instance debug: msg: "{{ ceph_mgr.stdout | regex_replace('^ceph-?(.*)-mgr.', '') }}" - when: tripleo_cephadm_verbose + when: tripleo_cephadm_verbose | bool - name: config the current dashboard backend command: | diff --git a/tripleo_ansible/roles/tripleo_cephadm/tasks/export.yaml b/tripleo_ansible/roles/tripleo_cephadm/tasks/export.yaml index bdbd9fedb..b6b1cf16a 100644 --- a/tripleo_ansible/roles/tripleo_cephadm/tasks/export.yaml +++ b/tripleo_ansible/roles/tripleo_cephadm/tasks/export.yaml @@ -25,7 +25,7 @@ - name: Wait for the expected number of monitors to be running include_tasks: wait_for_expected_num_mons.yaml when: - - not tripleo_cephadm_deployed_ceph + - not tripleo_cephadm_deployed_ceph | bool - tripleo_cephadm_wait_for_mons | bool - name: Run ceph mon dump to get all monitors diff --git a/tripleo_ansible/roles/tripleo_cephadm/tasks/post.yaml b/tripleo_ansible/roles/tripleo_cephadm/tasks/post.yaml index 8c646da65..6d207c667 100644 --- a/tripleo_ansible/roles/tripleo_cephadm/tasks/post.yaml +++ b/tripleo_ansible/roles/tripleo_cephadm/tasks/post.yaml @@ -39,7 +39,7 @@ - name: Deployed daemons debug: msg: "{{ ceph_orch_ls.stdout_lines }}" - when: tripleo_cephadm_verbose + when: tripleo_cephadm_verbose | bool - name: Print the status of the deployed Ceph cluster command: "{{ tripleo_cephadm_ceph_cli }} -s" become: true