Add AllNodesConfig to config-download group vars

Since I7b865bf82520006eef3ac2f36df34b1f3c34e642 added an AllNodesConfig
output to the overcloud, we can consume that in the group_vars
and add it to the main overcloud group which means the data will be
available to all overcloud nodes.

This may be helpful to solve issues resolving per-service bootstrap
nodes, and also the data there may be more generally useful in
ansible tasks.

Partial-Bug: #1792613
Depends-On: I7b865bf82520006eef3ac2f36df34b1f3c34e642
Change-Id: Idcee177b21e85cff9e0bf10f4c43c71eff9364ec
This commit is contained in:
Steven Hardy 2018-10-12 09:58:16 +01:00
parent 024a359e12
commit 1317799e84
1 changed files with 8 additions and 0 deletions

View File

@ -196,6 +196,7 @@ class Config(object):
# Get role data:
role_data = self.stack_outputs.get('RoleData', {})
role_group_vars = self.stack_outputs.get('RoleGroupVars', {})
allnodes_vars = self.stack_outputs.get('AllNodesConfig', {})
for role_name, role in six.iteritems(role_data):
role_path = os.path.join(config_dir, role_name)
self._mkdir(role_path)
@ -353,6 +354,13 @@ class Config(object):
group_vars_dir = os.path.join(config_dir, 'group_vars')
self._mkdir(group_vars_dir)
# Write allnodes_vars to 'overcloud' group as it doesn't apply
# to the undercloud, and 'overcloud' is the inventory group
# for all overcloud nodes, regardless of the --stack name.
filepath = os.path.join(group_vars_dir, 'overcloud.yaml')
with self._open_file(filepath) as vars_file:
yaml.safe_dump(allnodes_vars, vars_file, default_flow_style=False)
host_vars_dir = os.path.join(config_dir, 'host_vars')
self._mkdir(host_vars_dir)