tripleo-common/scripts/tripleo-config-download
James Slagle 381fc8c4fe Config download support for all deployments
Presently, "openstack overcloud config download" only supports the
OS::HeatSoftwareDeploymentGroup (plural) resources from
deploy-steps.yaml.

This patch adds support to the command to also pull the deployment
resources for each individual server from the OS::Heat::Value resources
called "TripleODeployment", as well as other SoftwareDeploymentGroup
resources not from deploy-steps.j2. See the Depends-On
tripleo-heat-templates patch for how these resources are mapped.

These deployments are applied by additional plays in the generated
playbooks. Instead of having to reimplement each deployment in a native
group:ansible, the ansible tasks just trigger the deployments by calling
55-heat-config remotely with the rendered json deployment data for
whatever deployment is being applied.

This method saves us from having to migrate all these resources to
native ansible (and requring all end users to do so).

Also included is a helper script called tripleo-config-download to run
the config download outside of Mistral.

implements: blueprint ansible-config-download
Change-Id: I7d7f6b831b8566390d8f747fb6f45e879b0392ba
Depends-On: Ic2af634403b1ab2924c383035f770453f39a2cd5
2017-10-17 13:59:53 -04:00

57 lines
1.7 KiB
Python
Executable File

#!/usr/bin/python
# Copyright 2016 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import argparse
import logging
import os
import sys
import os_client_config
from tripleo_common.utils import config
def get_orchestration_client():
return os_client_config.make_client('orchestration')
def get_args():
parser = argparse.ArgumentParser(
description=("tripleo-config-download"),
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--stack-name', '-s',
default='overcloud',
help="Heat stack name")
parser.add_argument('--output-dir', '-o',
default='tripleo-config-download',
help="Output directory for downloaded config")
args = parser.parse_args(sys.argv[1:])
return args
if __name__ == '__main__':
args = get_args()
logging.basicConfig()
log = logging.getLogger()
log.setLevel(logging.INFO)
if not os.path.exists(args.output_dir):
os.mkdir(args.output_dir)
client = get_orchestration_client()
stack_config = config.Config(client)
stack_config.download_config(args.stack_name, args.output_dir)