82 lines
2.3 KiB
Python
Raw Normal View History

#!/opt/ansible-runtime/bin/python
2014-08-26 18:08:15 -05:00
# 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.
#
# (c) 2014, Kevin Carter <kevin.carter@rackspace.com>
import argparse
import os
import sys
2014-08-26 18:08:15 -05:00
try:
from osa_toolkit import generate
except ImportError:
current_path = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
lib_path = os.path.join(current_path, '..')
sys.path.append(lib_path)
from osa_toolkit import generate
# Function kept in order to use relative pathing for the env.d directory
def args(arg_list):
2014-08-26 18:08:15 -05:00
"""Setup argument Parsing."""
parser = argparse.ArgumentParser(
usage='%(prog)s',
Remove and/or rename Rackspace related bits This patch removes and/or renames anything that is Rackspace specific from the playbooks, roles and variables. It also removes items which appear to be orphaned/unused and flattens the playbooks into a single directory in order to better match ansible best practise (and remove some horrible fiddles we were doing). The following have been removed due to RAX/RPC naming or RAX/RPC specific usage: - playbooks/monitoring - playbooks/rax* - playbooks/rpc* - roles/maas* - roles/rax* - roles/rpc* - scripts/f5-* - scripts/maas* - scripts/rpc* - scripts/*lab* - vars/repo_packages/rackspace* - vars/repo_packages/rax* - vars/repo_packages/rpc* - vars/repo_packages/holland.yml The following have been removed as they are unused: - playbooks/setup/host-network-setup.yml - roles/openssl_pem_request - roles/host_interfaces - scripts/elsa* - ssh/ - vars/repo_packages/turbolift.yml The following directories have been renamed: - etc/rpc_deploy > etc/openstack_deploy - rpc_deployment > playbooks The playbooks have all been moved into a single directory: - rpc_deployment/playbooks/infrastructure/* > playbooks/ - rpc_deployment/playbooks/openstack/* > playbooks/ - rpc_deployment/playbooks/setup/* > playbooks/ The following files have been renamed: - lxc-rpc > lxc-openstack - lxc-rpc.conf > lxc-openstack.conf - rpc_environment > openstack_environment - rpc_release > openstack_release (etc and pip) - rpc_tempest_gate.sh > openstack_tempest_gate.sh - rpc_user_config > openstack_user_config The following variables have been renamed: - rpc_release > openstack_release - rpc_repo_url > openstack_repo_url The following variables have been introduced: - openstack_code_name: The code name of the upstream OpenStack release (eg: Juno) Notable variable/template value changes: - rabbit_cluster_name: rpc > openstack - wsrep_cluster_name: rpc_galera_cluster > openstack_galera_cluster DocImpact Closes-Bug: #1403676 Implements: blueprint rackspace-namesake Change-Id: Ib480fdad500b03c7cb90684aa444da9946ba8032
2015-02-11 16:26:22 +00:00
description='OpenStack Inventory Generator',
2014-08-26 18:08:15 -05:00
epilog='Inventory Generator Licensed "Apache 2.0"')
parser.add_argument(
'--config',
help='Path containing the user defined configuration files',
2014-08-26 18:08:15 -05:00
required=False,
default=os.getenv('OSA_CONFIG_DIR', None)
2014-08-26 18:08:15 -05:00
)
parser.add_argument(
'--list',
help='List all entries',
action='store_true'
)
parser.add_argument(
'--check',
help="Configuration check only, don't generate inventory",
action='store_true',
)
parser.add_argument(
'-d',
'--debug',
help=('Output debug messages to log file. '
'File is appended to, not overwritten'),
action='store_true',
default=False,
)
parser.add_argument(
'-e',
'--environment',
help=('Directory that contains the base env.d directory.\n'
'Defaults to <OSA_ROOT>/inventory/.'),
required=False,
default=os.path.dirname(__file__),
)
return vars(parser.parse_args(arg_list))
2014-08-26 18:08:15 -05:00
if __name__ == '__main__':
all_args = args(sys.argv[1:])
output = generate.main(**all_args)
print(output)