Add env.d extra configuration directory to etc/openstack_deploy/
Like etc/openstack_deploy/conf.d/ we need a way to add additional containers to the infrastructure without modifying the provided openstack_environment.yml file. This patch looks for an env.d directory and merges their configurations into the inventory. An example extra_container configuration file is also provided. Closes-bug: 1440117 Change-Id: Ibc83770e69efb67996a012c96766b4a88774986e
This commit is contained in:
committed by
Jesse Pretorius
parent
4c4fbe25c3
commit
27f1d2d3ec
44
etc/openstack_deploy/env.d/extra_container.yml.example
Normal file
44
etc/openstack_deploy/env.d/extra_container.yml.example
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2014, Rackspace US, Inc.
|
||||||
|
# #
|
||||||
|
# # 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.
|
||||||
|
|
||||||
|
component_skel:
|
||||||
|
example_api:
|
||||||
|
belongs_to:
|
||||||
|
# This is a meta group of a given component type.
|
||||||
|
- example_all
|
||||||
|
|
||||||
|
container_skel:
|
||||||
|
example_api_container:
|
||||||
|
belongs_to:
|
||||||
|
# This is a group of containers mapped to a physical host.
|
||||||
|
- example-infra_containers
|
||||||
|
contains:
|
||||||
|
# This maps back to an item in the component_skel.
|
||||||
|
- example_api
|
||||||
|
properties:
|
||||||
|
# These are arbitrary key value pairs.
|
||||||
|
service_name: example_service
|
||||||
|
# This is the image that the lxc container will be built from.
|
||||||
|
container_release: trusty
|
||||||
|
|
||||||
|
physical_skel:
|
||||||
|
# This maps back to items in the container_skel.
|
||||||
|
example-infra_containers:
|
||||||
|
belongs_to:
|
||||||
|
- all_containers
|
||||||
|
# This is a required pair for the container physical entry.
|
||||||
|
example-infra_hosts:
|
||||||
|
belongs_to:
|
||||||
|
- hosts
|
||||||
@@ -556,7 +556,7 @@ def _add_additional_networks(key, inventory, ip_q, q_name, netmask, interface,
|
|||||||
if properties:
|
if properties:
|
||||||
is_metal = properties.get('is_metal', False)
|
is_metal = properties.get('is_metal', False)
|
||||||
|
|
||||||
## This should convert found addresses based on q_name + "_address"
|
# This should convert found addresses based on q_name + "_address"
|
||||||
# and then build the network if its not found.
|
# and then build the network if its not found.
|
||||||
if not is_metal and old_address not in networks:
|
if not is_metal and old_address not in networks:
|
||||||
network = networks[old_address] = network_entry()
|
network = networks[old_address] = network_entry()
|
||||||
@@ -857,7 +857,7 @@ def _merge_dict(base_items, new_items):
|
|||||||
|
|
||||||
|
|
||||||
def _extra_config(user_defined_config, base_dir):
|
def _extra_config(user_defined_config, base_dir):
|
||||||
"""Discover new items in a conf.d directory and add the new values.
|
"""Discover new items in any extra directories and add the new values.
|
||||||
|
|
||||||
:param user_defined_config: ``dict``
|
:param user_defined_config: ``dict``
|
||||||
:param base_dir: ``str``
|
:param base_dir: ``str``
|
||||||
@@ -920,6 +920,11 @@ def main():
|
|||||||
% (env_version, version)
|
% (env_version, version)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Load anything in an env.d directory if found
|
||||||
|
env_plugins = os.path.join(local_path, 'env.d')
|
||||||
|
if os.path.isdir(env_plugins):
|
||||||
|
_extra_config(user_defined_config=environment, base_dir=env_plugins)
|
||||||
|
|
||||||
# Load existing inventory file if found
|
# Load existing inventory file if found
|
||||||
dynamic_inventory_file = os.path.join(
|
dynamic_inventory_file = os.path.join(
|
||||||
local_path, 'openstack_inventory.json'
|
local_path, 'openstack_inventory.json'
|
||||||
|
|||||||
Reference in New Issue
Block a user