Allow processing external_deploy_steps_tasks

Process external_deploy_steps_tasks as a part of config download
mechanism, which will allow services to export Ansible tasks to be
executed on undercloud directly, with full undercloud and overcloud
inventory available.

These tasks can be used to perform complex actions from the
undercloud, such as executing nested installers like kubespray or
ceph-ansible. This should allow deploying overcloud with a single
Ansible playbook, and without creating Ansible->Mistral->Ansible loop.

Implements: blueprint ansible-config-download
Change-Id: I8491540edf78711f3229eabeda22a17cd55e99c8
This commit is contained in:
Jiri Stransky 2017-10-10 09:59:12 +02:00
parent 381fc8c4fe
commit e47e1dfc26
3 changed files with 15 additions and 4 deletions

View File

@ -145,3 +145,5 @@ SERVER_RESOURCE_TYPES = 'OS::TripleO::%sServer'
# Resource name for deployment resources when using config download
TRIPLEO_DEPLOYMENT_RESOURCE = 'TripleODeployment'
EXTERNAL_TASKS = ['external_deploy_tasks']

View File

@ -41,7 +41,8 @@ class TestConfig(base.TestCase):
'service_config_settings',
'service_metadata_settings',
'service_names',
'upgrade_batch_tasks', 'upgrade_tasks']
'upgrade_batch_tasks', 'upgrade_tasks',
'external_deploy_tasks']
fake_role = [role for role in
fakes.FAKE_STACK['outputs'][1]['output_value']]
@ -56,7 +57,9 @@ class TestConfig(base.TestCase):
expected_calls = []
for config in config_type_list:
for role in fake_role:
if config == 'step_config':
if 'external' in config:
continue
elif config == 'step_config':
expected_calls += [call('/tmp/tht/%s/%s.pp' %
(role, config))]
else:

View File

@ -180,7 +180,10 @@ class Config(object):
role_path = os.path.join(tmp_path, role_name)
self._mkdir(role_path)
for config in config_type or role.keys():
if config == 'step_config':
if config in constants.EXTERNAL_TASKS:
# external tasks are collected globally, not per-role
continue
elif config == 'step_config':
filepath = os.path.join(role_path, 'step_config.pp')
with self._open_file(filepath) as step_config:
step_config.write('\n'.join(step for step in
@ -208,7 +211,10 @@ class Config(object):
for config_name, config in six.iteritems(role_config):
conf_path = os.path.join(tmp_path, config_name + ".yaml")
with self._open_file(conf_path) as conf_file:
conf_file.write(config)
if isinstance(config, list) or isinstance(config, dict):
yaml.safe_dump(config, conf_file, default_flow_style=False)
else:
conf_file.write(config)
# Get deployment data
self.log.info("Getting server data from Heat...")