@@ -38,12 +38,15 @@ host_group_mapping=$(openstack server list --long -f json | python3 -c "import j
...
@@ -38,12 +38,15 @@ host_group_mapping=$(openstack server list --long -f json | python3 -c "import j
# all available ansible_host_groups
# all available ansible_host_groups
available_groups=$(echo$host_group_mapping | python3 -c"import json,sys;mapping=json.load(sys.stdin);output=[];[output.extend(v) for v in mapping.values()];print(output)" | tr-d"[',]")
available_groups=$(echo$host_group_mapping | python3 -c"import json,sys;mapping=json.load(sys.stdin);output=[];[output.extend(v) for v in mapping.values()];print(output)" | tr-d"[',]")
echo"available groups are $available_groups"
# if the first input parameter is all then rebuild all groups
# if the first input parameter is all then rebuild all groups
if[["$1"=="all"]];then
if[["$1"=="all"]];then
NODETYPES=$available_groups
NODETYPES=$available_groups
fi
fi
echo"going to update group $NODETYPES"
echo"going to update group $NODETYPES"
server_list=$(echo$host_group_mapping | python3 -c"import json,sys;mapping=json.load(sys.stdin);avail_groups='$available_groups'.split();print([k for k in mapping.keys() if len(set(mapping[k]).intersection(set(avail_groups))) > 0])" | tr-d"[,]'" | xargs -n1 | sort-u)
server_list=$(echo$host_group_mapping | python3 -c"import json,sys;mapping=json.load(sys.stdin);node_types='$NODETYPES'.split();output=[k for k in mapping.keys() if len(set(mapping[k]).intersection(set(node_types))) > 0];print(output)" | tr-d"[,]'" | xargs -n1 | sort-u)