From 286ecf3245153da5b5b50671a0903ae407ba72d2 Mon Sep 17 00:00:00 2001 From: Masco Date: Wed, 17 Aug 2022 14:45:04 +0530 Subject: [PATCH] fix osp-17 overcloud node count --- roles/openstack_undercloud/tasks/main.yml | 30 ++++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/roles/openstack_undercloud/tasks/main.yml b/roles/openstack_undercloud/tasks/main.yml index 696d510..4cad0a8 100644 --- a/roles/openstack_undercloud/tasks/main.yml +++ b/roles/openstack_undercloud/tasks/main.yml @@ -48,15 +48,27 @@ # ansible_env.HOME should've worked here -- name: Get Controller Nodes number - shell: source {{ user_homedir.stdout }}/stackrc; nova list | grep controller | grep ACTIVE | wc -l - register: controller_count - when: undercloud_conf.stat.exists - -- name: Get Compute Nodes number - shell: source {{ user_homedir.stdout }}/stackrc; nova list | grep compute | grep ACTIVE | wc -l - register: compute_count - when: undercloud_conf.stat.exists +- name: get overcloud node count before OSP-17 + block: + - name: Get Controller Nodes number + shell: source {{ user_homedir.stdout }}/stackrc; nova list | grep controller | grep ACTIVE | wc -l + register: controller_count + + - name: Get Compute Nodes number + shell: source {{ user_homedir.stdout }}/stackrc; nova list | grep compute | grep ACTIVE | wc -l + register: compute_count + when: rhosp_major is version('17', '<') and undercloud_conf.stat.exists + +- name: get overcloud node count on or after OSP-17 + block: + - name: Get Controller Nodes number + shell: source {{ user_homedir.stdout }}/stackrc; metalsmith list | grep controller | grep ACTIVE | wc -l + register: controller_count + + - name: Get Compute Nodes number + shell: source {{ user_homedir.stdout }}/stackrc; metalsmith list | grep compute | grep ACTIVE | wc -l + register: compute_count + when: rhosp_major is version('17', '>=') and undercloud_conf.stat.exists - name: setting fact set_fact: