diff options
author | spisarski <s.pisarski@cablelabs.com> | 2017-06-21 11:38:35 -0600 |
---|---|---|
committer | spisarski <s.pisarski@cablelabs.com> | 2017-06-21 11:38:35 -0600 |
commit | 39b46e7e43dffff8f4abfbc142c9e28c9ce0d260 (patch) | |
tree | 3f603967cd8aab9f6811ff78697806bc60f5de17 | |
parent | 43512a64f87dacdb43fd03e58a210d10fb0e5da7 (diff) |
Fixed launcher app to support new settings kwargs.
Additionally, found issue with importing ansible libraries.
Needed to rename the snaps.provisioning.ansible package to 'ansible_pb'.
JIRA: SNAPS-107 & SNAPS-93
Change-Id: I8c8628d3af5ce30849229ed47bfbb0ecaad5b3ad
Signed-off-by: spisarski <s.pisarski@cablelabs.com>
17 files changed, 356 insertions, 287 deletions
diff --git a/examples/launch.py b/examples/launch.py index c13d05f..8f6697a 100644 --- a/examples/launch.py +++ b/examples/launch.py @@ -18,16 +18,16 @@ # This script is responsible for deploying virtual environments import argparse import logging -import os import re +import os from snaps import file_utils from snaps.openstack.create_flavor import FlavorSettings, OpenStackFlavor -from snaps.openstack.create_image import ImageSettings +from snaps.openstack.create_image import ImageSettings, OpenStackImage from snaps.openstack.create_instance import VmInstanceSettings +from snaps.openstack.create_keypairs import KeypairSettings from snaps.openstack.create_network import PortSettings, NetworkSettings from snaps.openstack.create_router import RouterSettings -from snaps.openstack.create_keypairs import KeypairSettings from snaps.openstack.os_credentials import OSCreds, ProxySettings from snaps.openstack.utils import deploy_utils from snaps.provisioning import ansible_utils @@ -41,7 +41,8 @@ ARG_NOT_SET = "argument not set" def __get_os_credentials(os_conn_config): """ - Returns an object containing all of the information required to access OpenStack APIs + Returns an object containing all of the information required to access + OpenStack APIs :param os_conn_config: The configuration holding the credentials :return: an OSCreds instance """ @@ -67,16 +68,17 @@ def __parse_ports_config(config): """ out = list() for port_config in config: - out.append(PortSettings(config=port_config.get('port'))) + out.append(PortSettings(**port_config.get('port'))) return out def __create_flavors(os_conn_config, flavors_config, cleanup=False): """ - Returns a dictionary of flavors where the key is the image name and the value is the image object + Returns a dictionary of flavors where the key is the image name and the + value is the image object :param os_conn_config: The OpenStack connection credentials :param flavors_config: The list of image configurations - :param cleanup: Denotes whether or not this is being called for cleanup or not + :param cleanup: Denotes whether or not this is being called for cleanup :return: dictionary """ flavors = {} @@ -86,8 +88,9 @@ def __create_flavors(os_conn_config, flavors_config, cleanup=False): for flavor_config_dict in flavors_config: flavor_config = flavor_config_dict.get('flavor') if flavor_config and flavor_config.get('name'): - flavor_creator = OpenStackFlavor(__get_os_credentials(os_conn_config), - FlavorSettings(flavor_config)) + flavor_creator = OpenStackFlavor( + __get_os_credentials(os_conn_config), + FlavorSettings(**flavor_config)) flavor_creator.create(cleanup=cleanup) flavors[flavor_config['name']] = flavor_creator except Exception as e: @@ -101,10 +104,11 @@ def __create_flavors(os_conn_config, flavors_config, cleanup=False): def __create_images(os_conn_config, images_config, cleanup=False): """ - Returns a dictionary of images where the key is the image name and the value is the image object + Returns a dictionary of images where the key is the image name and the + value is the image object :param os_conn_config: The OpenStack connection credentials :param images_config: The list of image configurations - :param cleanup: Denotes whether or not this is being called for cleanup or not + :param cleanup: Denotes whether or not this is being called for cleanup :return: dictionary """ images = {} @@ -114,8 +118,9 @@ def __create_images(os_conn_config, images_config, cleanup=False): for image_config_dict in images_config: image_config = image_config_dict.get('image') if image_config and image_config.get('name'): - images[image_config['name']] = deploy_utils.create_image(__get_os_credentials(os_conn_config), - ImageSettings(image_config), cleanup) + images[image_config['name']] = deploy_utils.create_image( + __get_os_credentials(os_conn_config), + ImageSettings(**image_config), cleanup) except Exception as e: for key, image_creator in images.items(): image_creator.clean() @@ -127,10 +132,11 @@ def __create_images(os_conn_config, images_config, cleanup=False): def __create_networks(os_conn_config, network_confs, cleanup=False): """ - Returns a dictionary of networks where the key is the network name and the value is the network object + Returns a dictionary of networks where the key is the network name and the + value is the network object :param os_conn_config: The OpenStack connection credentials :param network_confs: The list of network configurations - :param cleanup: Denotes whether or not this is being called for cleanup or not + :param cleanup: Denotes whether or not this is being called for cleanup :return: dictionary """ network_dict = {} @@ -141,7 +147,8 @@ def __create_networks(os_conn_config, network_confs, cleanup=False): net_name = network_conf['network']['name'] os_creds = __get_os_credentials(os_conn_config) network_dict[net_name] = deploy_utils.create_network( - os_creds, NetworkSettings(config=network_conf['network']), cleanup) + os_creds, NetworkSettings(**network_conf['network']), + cleanup) except Exception as e: for key, net_creator in network_dict.items(): net_creator.clean() @@ -154,10 +161,11 @@ def __create_networks(os_conn_config, network_confs, cleanup=False): def __create_routers(os_conn_config, router_confs, cleanup=False): """ - Returns a dictionary of networks where the key is the network name and the value is the network object + Returns a dictionary of networks where the key is the network name and the + value is the network object :param os_conn_config: The OpenStack connection credentials :param router_confs: The list of router configurations - :param cleanup: Denotes whether or not this is being called for cleanup or not + :param cleanup: Denotes whether or not this is being called for cleanup :return: dictionary """ router_dict = {} @@ -168,7 +176,7 @@ def __create_routers(os_conn_config, router_confs, cleanup=False): for router_conf in router_confs: router_name = router_conf['router']['name'] router_dict[router_name] = deploy_utils.create_router( - os_creds, RouterSettings(config=router_conf['router']), cleanup) + os_creds, RouterSettings(**router_conf['router']), cleanup) except Exception as e: for key, router_creator in router_dict.items(): router_creator.clean() @@ -181,10 +189,11 @@ def __create_routers(os_conn_config, router_confs, cleanup=False): def __create_keypairs(os_conn_config, keypair_confs, cleanup=False): """ - Returns a dictionary of keypairs where the key is the keypair name and the value is the keypair object + Returns a dictionary of keypairs where the key is the keypair name and the + value is the keypair object :param os_conn_config: The OpenStack connection credentials :param keypair_confs: The list of keypair configurations - :param cleanup: Denotes whether or not this is being called for cleanup or not + :param cleanup: Denotes whether or not this is being called for cleanup :return: dictionary """ keypairs_dict = {} @@ -192,8 +201,9 @@ def __create_keypairs(os_conn_config, keypair_confs, cleanup=False): try: for keypair_dict in keypair_confs: keypair_config = keypair_dict['keypair'] - kp_settings = KeypairSettings(keypair_config) - keypairs_dict[keypair_config['name']] = deploy_utils.create_keypair( + kp_settings = KeypairSettings(**keypair_config) + keypairs_dict[ + keypair_config['name']] = deploy_utils.create_keypair( __get_os_credentials(os_conn_config), kp_settings, cleanup) except Exception as e: for key, keypair_creator in keypairs_dict.items(): @@ -205,14 +215,18 @@ def __create_keypairs(os_conn_config, keypair_confs, cleanup=False): return keypairs_dict -def __create_instances(os_conn_config, instances_config, image_dict, keypairs_dict, cleanup=False): +def __create_instances(os_conn_config, instances_config, image_dict, + keypairs_dict, cleanup=False): """ - Returns a dictionary of instances where the key is the instance name and the value is the VM object + Returns a dictionary of instances where the key is the instance name and + the value is the VM object :param os_conn_config: The OpenStack connection credentials :param instances_config: The list of VM instance configurations - :param image_dict: A dictionary of images that will probably be used to instantiate the VM instance - :param keypairs_dict: A dictionary of keypairs that will probably be used to instantiate the VM instance - :param cleanup: Denotes whether or not this is being called for cleanup or not + :param image_dict: A dictionary of images that will probably be used to + instantiate the VM instance + :param keypairs_dict: A dictionary of keypairs that will probably be used + to instantiate the VM instance + :param cleanup: Denotes whether or not this is being called for cleanup :return: dictionary """ os_creds = __get_os_credentials(os_conn_config) @@ -227,19 +241,27 @@ def __create_instances(os_conn_config, instances_config, image_dict, keypairs_di if image_dict: image_creator = image_dict.get(conf.get('imageName')) if image_creator: - instance_settings = VmInstanceSettings(config=instance_config['instance']) + instance_settings = VmInstanceSettings( + **instance_config['instance']) kp_name = conf.get('keypair_name') - vm_dict[conf['name']] = deploy_utils.create_vm_instance( - os_creds, instance_settings, image_creator.image_settings, - keypair_creator=keypairs_dict[kp_name], cleanup=cleanup) + vm_dict[conf[ + 'name']] = deploy_utils.create_vm_instance( + os_creds, instance_settings, + image_creator.image_settings, + keypair_creator=keypairs_dict[kp_name], + cleanup=cleanup) else: - raise Exception('Image creator instance not found. Cannot instantiate') + raise Exception('Image creator instance not found.' + ' Cannot instantiate') else: - raise Exception('Image dictionary is None. Cannot instantiate') + raise Exception('Image dictionary is None. Cannot ' + 'instantiate') else: - raise Exception('Instance configuration is None. Cannot instantiate') + raise Exception('Instance configuration is None. Cannot ' + 'instantiate') except Exception as e: - logger.error('Unexpected error creating instances. Attempting to cleanup environment - ' + str(e)) + logger.error('Unexpected error creating instances. Attempting to ' + 'cleanup environment - %s', e) for key, inst_creator in vm_dict.items(): inst_creator.clean() raise e @@ -249,16 +271,21 @@ def __create_instances(os_conn_config, instances_config, image_dict, keypairs_di return vm_dict -def __apply_ansible_playbooks(ansible_configs, os_conn_config, vm_dict, image_dict, flavor_dict, env_file): +def __apply_ansible_playbooks(ansible_configs, os_conn_config, vm_dict, + image_dict, flavor_dict, env_file): """ Applies ansible playbooks to running VMs with floating IPs :param ansible_configs: a list of Ansible configurations - :param os_conn_config: the OpenStack connection configuration used to create an OSCreds instance - :param vm_dict: the dictionary of newly instantiated VMs where the name is the key - :param image_dict: the dictionary of newly instantiated images where the name is the key - :param flavor_dict: the dictionary of newly instantiated flavors where the name is the key - :param env_file: the path of the environment for setting the CWD so playbook location is relative to the deployment - file + :param os_conn_config: the OpenStack connection configuration used to + create an OSCreds instance + :param vm_dict: the dictionary of newly instantiated VMs where the name is + the key + :param image_dict: the dictionary of newly instantiated images where the + name is the key + :param flavor_dict: the dictionary of newly instantiated flavors where the + name is the key + :param env_file: the path of the environment for setting the CWD so + playbook location is relative to the deployment file :return: t/f - true if successful """ logger.info("Applying Ansible Playbooks") @@ -266,10 +293,12 @@ def __apply_ansible_playbooks(ansible_configs, os_conn_config, vm_dict, image_di # Ensure all hosts are accepting SSH session requests for vm_inst in list(vm_dict.values()): if not vm_inst.vm_ssh_active(block=True): - logger.warning("Timeout waiting for instance to respond to SSH requests") + logger.warning( + "Timeout waiting for instance to respond to SSH requests") return False - # Set CWD so the deployment file's playbook location can leverage relative paths + # Set CWD so the deployment file's playbook location can leverage + # relative paths orig_cwd = os.getcwd() env_dir = os.path.dirname(env_file) os.chdir(env_dir) @@ -277,7 +306,8 @@ def __apply_ansible_playbooks(ansible_configs, os_conn_config, vm_dict, image_di # Apply playbooks for ansible_config in ansible_configs: os_creds = __get_os_credentials(os_conn_config) - __apply_ansible_playbook(ansible_config, os_creds, vm_dict, image_dict, flavor_dict) + __apply_ansible_playbook(ansible_config, os_creds, vm_dict, + image_dict, flavor_dict) # Return to original directory os.chdir(orig_cwd) @@ -285,25 +315,36 @@ def __apply_ansible_playbooks(ansible_configs, os_conn_config, vm_dict, image_di return True -def __apply_ansible_playbook(ansible_config, os_creds, vm_dict, image_dict, flavor_dict): +def __apply_ansible_playbook(ansible_config, os_creds, vm_dict, image_dict, + flavor_dict): """ Applies an Ansible configuration setting :param ansible_config: the configuration settings :param os_creds: the OpenStack credentials object - :param vm_dict: the dictionary of newly instantiated VMs where the name is the key - :param image_dict: the dictionary of newly instantiated images where the name is the key - :param flavor_dict: the dictionary of newly instantiated flavors where the name is the key + :param vm_dict: the dictionary of newly instantiated VMs where the name is + the key + :param image_dict: the dictionary of newly instantiated images where the + name is the key + :param flavor_dict: the dictionary of newly instantiated flavors where the + name is the key """ if ansible_config: - remote_user, floating_ips, private_key_filepath, proxy_settings = __get_connection_info(ansible_config, vm_dict) + (remote_user, floating_ips, private_key_filepath, + proxy_settings) = __get_connection_info( + ansible_config, vm_dict) if floating_ips: retval = ansible_utils.apply_playbook( - ansible_config['playbook_location'], floating_ips, remote_user, private_key_filepath, - variables=__get_variables(ansible_config.get('variables'), os_creds, vm_dict, image_dict, flavor_dict), + ansible_config['playbook_location'], floating_ips, remote_user, + private_key_filepath, + variables=__get_variables(ansible_config.get('variables'), + os_creds, vm_dict, image_dict, + flavor_dict), proxy_setting=proxy_settings) if retval != 0: # Not a fatal type of event - logger.warning('Unable to apply playbook found at location - ' + ansible_config('playbook_location')) + logger.warning( + 'Unable to apply playbook found at location - ' + + ansible_config('playbook_location')) def __get_connection_info(ansible_config, vm_dict): @@ -312,16 +353,19 @@ def __get_connection_info(ansible_config, vm_dict): (remote_user, [floating_ips], private_key_filepath, proxy_settings) :param ansible_config: the configuration settings :param vm_dict: the dictionary of VMs where the VM name is the key - :return: tuple where the first element is the user and the second is a list of floating IPs and the third is the - private key file location and the fourth is an instance of the snaps.ProxySettings class - (note: in order to work, each of the hosts need to have the same sudo_user and private key file location values) + :return: tuple where the first element is the user and the second is a list + of floating IPs and the third is the + private key file location and the fourth is an instance of the + snaps.ProxySettings class + (note: in order to work, each of the hosts need to have the same sudo_user + and private key file location values) """ if ansible_config.get('hosts'): hosts = ansible_config['hosts'] if len(hosts) > 0: floating_ips = list() remote_user = None - private_key_filepath = None + pk_file = None proxy_settings = None for host in hosts: vm = vm_dict.get(host) @@ -333,48 +377,63 @@ def __get_connection_info(ansible_config, vm_dict): if fip: floating_ips.append(fip.ip) else: - raise Exception('Could not find floating IP for VM - ' + vm.name) + raise Exception( + 'Could not find floating IP for VM - ' + + vm.name) - private_key_filepath = vm.keypair_settings.private_filepath + pk_file = vm.keypair_settings.private_filepath proxy_settings = vm.get_os_creds().proxy_settings else: logger.error('Could not locate VM with name - ' + host) - return remote_user, floating_ips, private_key_filepath, proxy_settings + return remote_user, floating_ips, pk_file, proxy_settings return None def __get_variables(var_config, os_creds, vm_dict, image_dict, flavor_dict): """ - Returns a dictionary of substitution variables to be used for Ansible templates + Returns a dictionary of substitution variables to be used for Ansible + templates :param var_config: the variable configuration settings :param os_creds: the OpenStack credentials object - :param vm_dict: the dictionary of newly instantiated VMs where the name is the key - :param image_dict: the dictionary of newly instantiated images where the name is the key - :param flavor_dict: the dictionary of newly instantiated flavors where the name is the key + :param vm_dict: the dictionary of newly instantiated VMs where the name is + the key + :param image_dict: the dictionary of newly instantiated images where the + name is the key + :param flavor_dict: the dictionary of newly instantiated flavors where the + name is the key :return: dictionary or None """ if var_config and vm_dict and len(vm_dict) > 0: variables = dict() for key, value in var_config.items(): - value = __get_variable_value(value, os_creds, vm_dict, image_dict, flavor_dict) + value = __get_variable_value(value, os_creds, vm_dict, image_dict, + flavor_dict) if key and value: variables[key] = value - logger.info("Set Jinga2 variable with key [" + key + "] the value [" + value + ']') + logger.info( + "Set Jinga2 variable with key [%s] the value [%s]", + key, value) else: - logger.warning('Key [' + str(key) + '] or Value [' + str(value) + '] must not be None') + logger.warning('Key [%s] or Value [%s] must not be None', + str(key), str(value)) return variables return None -def __get_variable_value(var_config_values, os_creds, vm_dict, image_dict, flavor_dict): +def __get_variable_value(var_config_values, os_creds, vm_dict, image_dict, + flavor_dict): """ - Returns the associated variable value for use by Ansible for substitution purposes + Returns the associated variable value for use by Ansible for substitution + purposes :param var_config_values: the configuration dictionary :param os_creds: the OpenStack credentials object - :param vm_dict: the dictionary of newly instantiated VMs where the name is the key - :param image_dict: the dictionary of newly instantiated images where the name is the key - :param flavor_dict: the dictionary of newly instantiated flavors where the name is the key + :param vm_dict: the dictionary of newly instantiated VMs where the name is + the key + :param image_dict: the dictionary of newly instantiated images where the + name is the key + :param flavor_dict: the dictionary of newly instantiated flavors where the + name is the key :return: """ if var_config_values['type'] == 'string': @@ -405,7 +464,8 @@ def __get_vm_attr_variable_value(var_config_values, vm_dict): """ Returns the associated value contained on a VM instance :param var_config_values: the configuration dictionary - :param vm_dict: the dictionary containing all VMs where the key is the VM's name + :param vm_dict: the dictionary containing all VMs where the key is the VM's + name :return: the value """ vm = vm_dict.get(var_config_values['vm_name']) @@ -446,7 +506,8 @@ def __get_vm_port_variable_value(var_config_values, vm_dict): """ Returns the associated OS credentials value :param var_config_values: the configuration dictionary - :param vm_dict: the dictionary containing all VMs where the key is the VM's name + :param vm_dict: the dictionary containing all VMs where the key is the VM's + name :return: the value """ port_name = var_config_values.get('port_name') @@ -467,7 +528,8 @@ def __get_image_variable_value(var_config_values, image_dict): """ Returns the associated image value :param var_config_values: the configuration dictionary - :param image_dict: the dictionary containing all images where the key is the name + :param image_dict: the dictionary containing all images where the key is + the name :return: the value """ logger.info("Retrieving image values") @@ -476,9 +538,11 @@ def __get_image_variable_value(var_config_values, image_dict): if var_config_values.get('image_name'): image_creator = image_dict.get(var_config_values['image_name']) if image_creator: - if var_config_values.get('value') and var_config_values['value'] == 'id': + if var_config_values.get('value') and \ + var_config_values['value'] == 'id': return image_creator.get_image().id - if var_config_values.get('value') and var_config_values['value'] == 'user': + if var_config_values.get('value') and \ + var_config_values['value'] == 'user': return image_creator.image_settings.image_user logger.info("Returning none") @@ -489,7 +553,8 @@ def __get_flavor_variable_value(var_config_values, flavor_dict): """ Returns the associated flavor value :param var_config_values: the configuration dictionary - :param flavor_dict: the dictionary containing all flavor creators where the key is the name + :param flavor_dict: the dictionary containing all flavor creators where the + key is the name :return: the value or None """ logger.info("Retrieving flavor values") @@ -498,7 +563,8 @@ def __get_flavor_variable_value(var_config_values, flavor_dict): if var_config_values.get('flavor_name'): flavor_creator = flavor_dict.get(var_config_values['flavor_name']) if flavor_creator: - if var_config_values.get('value') and var_config_values['value'] == 'id': + if var_config_values.get('value') and \ + var_config_values['value'] == 'id': return flavor_creator.get_flavor().id logger.info("Returning none") @@ -507,8 +573,9 @@ def __get_flavor_variable_value(var_config_values, flavor_dict): def main(arguments): """ - Will need to set environment variable ANSIBLE_HOST_KEY_CHECKING=False or ... - Create a file located in /etc/ansible/ansible/cfg or ~/.ansible.cfg containing the following content: + Will need to set environment variable ANSIBLE_HOST_KEY_CHECKING=False or + Create a file located in /etc/ansible/ansible/cfg or ~/.ansible.cfg + containing the following content: [defaults] host_key_checking = False @@ -530,51 +597,62 @@ def main(arguments): os_config = config.get('openstack') os_conn_config = None - flavor_dict = {} - image_dict = {} - network_dict = {} - router_dict = {} - keypairs_dict = {} - vm_dict = {} + creators = list() + vm_dict = dict() + images_dict = dict() + flavors_dict = dict() if os_config: try: os_conn_config = os_config.get('connection') # Create flavors - flavor_dict = __create_flavors(os_conn_config, os_config.get('flavors'), - arguments.clean is not ARG_NOT_SET) + flavors_dict = __create_flavors( + os_conn_config, os_config.get('flavors'), + arguments.clean is not ARG_NOT_SET) + creators.append(flavors_dict) # Create images - image_dict = __create_images(os_conn_config, os_config.get('images'), - arguments.clean is not ARG_NOT_SET) + images_dict = __create_images( + os_conn_config, os_config.get('images'), + arguments.clean is not ARG_NOT_SET) + creators.append(images_dict) # Create network - network_dict = __create_networks(os_conn_config, os_config.get('networks'), - arguments.clean is not ARG_NOT_SET) + creators.append(__create_networks( + os_conn_config, os_config.get('networks'), + arguments.clean is not ARG_NOT_SET)) - # Create network - router_dict = __create_routers(os_conn_config, os_config.get('routers'), - arguments.clean is not ARG_NOT_SET) + # Create routers + creators.append(__create_routers( + os_conn_config, os_config.get('routers'), + arguments.clean is not ARG_NOT_SET)) # Create keypairs - keypairs_dict = __create_keypairs(os_conn_config, os_config.get('keypairs'), - arguments.clean is not ARG_NOT_SET) + keypairs_dict = __create_keypairs( + os_conn_config, os_config.get('keypairs'), + arguments.clean is not ARG_NOT_SET) + creators.append(keypairs_dict) # Create instance - vm_dict = __create_instances(os_conn_config, os_config.get('instances'), image_dict, keypairs_dict, - arguments.clean is not ARG_NOT_SET) - logger.info('Completed creating/retrieving all configured instances') + vm_dict = __create_instances( + os_conn_config, os_config.get('instances'), + images_dict, keypairs_dict, + arguments.clean is not ARG_NOT_SET) + creators.append(vm_dict) + logger.info( + 'Completed creating/retrieving all configured instances') except Exception as e: - logger.error('Unexpected error deploying environment. Rolling back due to - ' + str(e)) - __cleanup(vm_dict, keypairs_dict, router_dict, network_dict, image_dict, flavor_dict, True) - raise e + logger.error( + 'Unexpected error deploying environment. Rolling back due' + ' to - ' + str(e)) + __cleanup(creators) + raise # Must enter either block if arguments.clean is not ARG_NOT_SET: # Cleanup Environment - __cleanup(vm_dict, keypairs_dict, router_dict, network_dict, image_dict, flavor_dict, - arguments.clean_image is not ARG_NOT_SET) + __cleanup(creators, arguments.clean_image is not ARG_NOT_SET) elif arguments.deploy is not ARG_NOT_SET: logger.info('Configuring NICs where required') for vm in vm_dict.values(): @@ -584,56 +662,58 @@ def main(arguments): # Provision VMs ansible_config = config.get('ansible') if ansible_config and vm_dict: - if not __apply_ansible_playbooks(ansible_config, os_conn_config, vm_dict, image_dict, flavor_dict, + if not __apply_ansible_playbooks(ansible_config, + os_conn_config, vm_dict, + images_dict, flavors_dict, arguments.environment): logger.error("Problem applying ansible playbooks") else: - logger.error('Unable to read configuration file - ' + arguments.environment) + logger.error( + 'Unable to read configuration file - ' + arguments.environment) exit(1) exit(0) -def __cleanup(vm_dict, keypairs_dict, router_dict, network_dict, image_dict, flavor_dict, clean_image=False): - for key, vm_inst in vm_dict.items(): - vm_inst.clean() - for key, kp_inst in keypairs_dict.items(): - kp_inst.clean() - for key, router_inst in router_dict.items(): - try: - router_inst.clean() - except Exception: - logger.warning("Router not found continuing to next component") - for key, net_inst in network_dict.items(): - try: - net_inst.clean() - except Exception: - logger.warning("Network not found continuing to next component") - if clean_image: - for key, image_inst in image_dict.items(): - image_inst.clean() - for key, flavor_inst in flavor_dict.items(): - flavor_inst.clean() +def __cleanup(creators, clean_image=False): + for creator_dict in reversed(creators): + for key, creator in creator_dict.items(): + if (isinstance(creator, OpenStackImage) and clean_image) or \ + not isinstance(creator, OpenStackImage): + try: + creator.clean() + except Exception as e: + logger.warning('Error cleaning component - %s', e) if __name__ == '__main__': - # To ensure any files referenced via a relative path will begin from the diectory in which this file resides + # To ensure any files referenced via a relative path will begin from the + # directory in which this file resides os.chdir(os.path.dirname(os.path.realpath(__file__))) parser = argparse.ArgumentParser() - parser.add_argument('-d', '--deploy', dest='deploy', nargs='?', default=ARG_NOT_SET, - help='When used, environment will be deployed and provisioned') - parser.add_argument('-c', '--clean', dest='clean', nargs='?', default=ARG_NOT_SET, - help='When used, the environment will be removed') - parser.add_argument('-i', '--clean-image', dest='clean_image', nargs='?', default=ARG_NOT_SET, - help='When cleaning, if this is set, the image will be cleaned too') - parser.add_argument('-e', '--env', dest='environment', required=True, - help='The environment configuration YAML file - REQUIRED') - parser.add_argument('-l', '--log-level', dest='log_level', default='INFO', help='Logging Level (INFO|DEBUG)') + parser.add_argument( + '-d', '--deploy', dest='deploy', nargs='?', default=ARG_NOT_SET, + help='When used, environment will be deployed and provisioned') + parser.add_argument( + '-c', '--clean', dest='clean', nargs='?', default=ARG_NOT_SET, + help='When used, the environment will be removed') + parser.add_argument( + '-i', '--clean-image', dest='clean_image', nargs='?', + default=ARG_NOT_SET, + help='When cleaning, if this is set, the image will be cleaned too') + parser.add_argument( + '-e', '--env', dest='environment', required=True, + help='The environment configuration YAML file - REQUIRED') + parser.add_argument( + '-l', '--log-level', dest='log_level', default='INFO', + help='Logging Level (INFO|DEBUG)') args = parser.parse_args() if args.deploy is ARG_NOT_SET and args.clean is ARG_NOT_SET: - print('Must enter either -d for deploy or -c for cleaning up and environment') + print( + 'Must enter either -d for deploy or -c for cleaning up and ' + 'environment') exit(1) if args.deploy is not ARG_NOT_SET and args.clean is not ARG_NOT_SET: print('Cannot enter both options -d/--deploy and -c/--clean') diff --git a/snaps/openstack/create_network.py b/snaps/openstack/create_network.py index 8357313..3aa379b 100644 --- a/snaps/openstack/create_network.py +++ b/snaps/openstack/create_network.py @@ -413,6 +413,9 @@ class PortSettings: For example, a virtual server. :return: """ + if 'port' in kwargs: + kwargs = kwargs['port'] + self.network = None self.name = kwargs.get('name') diff --git a/snaps/openstack/tests/openstack_tests.py b/snaps/openstack/tests/openstack_tests.py index 71d4d0e..bfcadaf 100644 --- a/snaps/openstack/tests/openstack_tests.py +++ b/snaps/openstack/tests/openstack_tests.py @@ -12,46 +12,53 @@ # 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 pkg_resources +import logging import re +import pkg_resources from snaps import file_utils -from snaps.openstack.utils import glance_utils +from snaps.openstack.create_image import ImageSettings from snaps.openstack.create_network import NetworkSettings, SubnetSettings from snaps.openstack.create_router import RouterSettings from snaps.openstack.os_credentials import OSCreds, ProxySettings -from snaps.openstack.create_image import ImageSettings -import logging +from snaps.openstack.utils import glance_utils __author__ = 'spisarski' - logger = logging.getLogger('openstack_tests') -CIRROS_DEFAULT_IMAGE_URL = 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img' -CIRROS_DEFAULT_KERNEL_IMAGE_URL = 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-kernel' -CIRROS_DEFAULT_RAMDISK_IMAGE_URL = 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-initramfs' +CIRROS_DEFAULT_IMAGE_URL =\ + 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img' +CIRROS_DEFAULT_KERNEL_IMAGE_URL =\ + 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-kernel' +CIRROS_DEFAULT_RAMDISK_IMAGE_URL =\ + 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-initramfs' CIRROS_USER = 'cirros' -CENTOS_DEFAULT_IMAGE_URL = 'http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2' +CENTOS_DEFAULT_IMAGE_URL =\ + 'http://cloud.centos.org/centos/7/images/' \ + 'CentOS-7-x86_64-GenericCloud.qcow2' CENTOS_USER = 'centos' -UBUNTU_DEFAULT_IMAGE_URL =\ - 'http://uec-images.ubuntu.com/releases/trusty/14.04/ubuntu-14.04-server-cloudimg-amd64-disk1.img' +UBUNTU_DEFAULT_IMAGE_URL = \ + 'http://uec-images.ubuntu.com/releases/trusty/14.04/' \ + 'ubuntu-14.04-server-cloudimg-amd64-disk1.img' UBUNTU_USER = 'ubuntu' DEFAULT_IMAGE_FORMAT = 'qcow2' -def get_credentials(os_env_file=None, proxy_settings_str=None, ssh_proxy_cmd=None, dev_os_env_file=None): +def get_credentials(os_env_file=None, proxy_settings_str=None, + ssh_proxy_cmd=None, dev_os_env_file=None): """ - Returns the OpenStack credentials object. It first attempts to retrieve them from a standard OpenStack source file. - If that file is None, it will attempt to retrieve them with a YAML file. - it will retrieve them from a + Returns the OpenStack credentials object. It first attempts to retrieve + them from a standard OpenStack source file. If that file is None, it will + attempt to retrieve them with a YAML file. :param os_env_file: the OpenStack source file :param proxy_settings_str: proxy settings string <host>:<port> (optional) :param ssh_proxy_cmd: the SSH proxy command for your environment (optional) - :param dev_os_env_file: the YAML file to retrieve both the OS credentials and proxy settings + :param dev_os_env_file: the YAML file to retrieve both the OS credentials + and proxy settings :return: the SNAPS credentials object """ if os_env_file: @@ -101,31 +108,42 @@ def get_credentials(os_env_file=None, proxy_settings_str=None, ssh_proxy_cmd=Non proxy_str = config.get('http_proxy') if proxy_str: tokens = re.split(':', proxy_str) - proxy_settings = ProxySettings(tokens[0], tokens[1], config.get('ssh_proxy_cmd')) - - os_creds = OSCreds(username=config['username'], password=config['password'], - auth_url=config['os_auth_url'], project_name=config['project_name'], - identity_api_version=identity_api_version, image_api_version=image_api_version, + proxy_settings = ProxySettings(tokens[0], tokens[1], + config.get('ssh_proxy_cmd')) + + os_creds = OSCreds(username=config['username'], + password=config['password'], + auth_url=config['os_auth_url'], + project_name=config['project_name'], + identity_api_version=identity_api_version, + image_api_version=image_api_version, proxy_settings=proxy_settings) logger.info('OS Credentials = ' + str(os_creds)) return os_creds -def create_image_settings(image_name, image_user, image_format, metadata, disk_url=None, default_url=None, - kernel_settings=None, ramdisk_settings=None, public=False, nic_config_pb_loc=None): +def create_image_settings(image_name, image_user, image_format, metadata, + disk_url=None, default_url=None, + kernel_settings=None, ramdisk_settings=None, + public=False, nic_config_pb_loc=None): """ Returns the image settings object :param image_name: the name of the image :param image_user: the image's sudo user :param image_format: the image's format string - :param metadata: custom metadata for overriding default behavior for test image settings + :param metadata: custom metadata for overriding default behavior for test + image settings :param disk_url: the disk image's URL :param default_url: the default URL for the disk image - :param kernel_settings: override to the kernel settings from the image_metadata - :param ramdisk_settings: override to the ramdisk settings from the image_metadata - :param public: True denotes image can be used by other projects where False indicates the converse (default: False) - :param nic_config_pb_loc: The location of the playbook used for configuring multiple NICs + :param kernel_settings: override to the kernel settings from the + image_metadata + :param ramdisk_settings: override to the ramdisk settings from the + image_metadata + :param public: True denotes image can be used by other projects where False + indicates the converse (default: False) + :param nic_config_pb_loc: The location of the playbook used for configuring + multiple NICs :return: """ @@ -143,17 +161,25 @@ def create_image_settings(image_name, image_user, image_format, metadata, disk_u else: disk_url = disk_url - if metadata and ('kernel_file' in metadata or 'kernel_url' in metadata) and kernel_settings is None: + if metadata and \ + ('kernel_file' in metadata or 'kernel_url' in metadata) and \ + kernel_settings is None: kernel_image_settings = ImageSettings( - name=image_name + '-kernel', image_user=image_user, img_format=image_format, - image_file=metadata.get('kernel_file'), url=metadata.get('kernel_url'), public=public) + name=image_name + '-kernel', image_user=image_user, + img_format=image_format, + image_file=metadata.get('kernel_file'), + url=metadata.get('kernel_url'), public=public) else: kernel_image_settings = kernel_settings - if metadata and ('ramdisk_file' in metadata or 'ramdisk_url' in metadata) and ramdisk_settings is None: + if metadata and \ + ('ramdisk_file' in metadata or 'ramdisk_url' in metadata) and \ + ramdisk_settings is None: ramdisk_image_settings = ImageSettings( - name=image_name + '-ramdisk', image_user=image_user, img_format=image_format, - image_file=metadata.get('ramdisk_file'), url=metadata.get('ramdisk_url'), public=public) + name=image_name + '-ramdisk', image_user=image_user, + img_format=image_format, + image_file=metadata.get('ramdisk_file'), + url=metadata.get('ramdisk_url'), public=public) else: ramdisk_image_settings = ramdisk_settings @@ -161,22 +187,30 @@ def create_image_settings(image_name, image_user, image_format, metadata, disk_u if metadata and 'extra_properties' in metadata: extra_properties = metadata['extra_properties'] - return ImageSettings(name=image_name, image_user=image_user, img_format=image_format, image_file=disk_file, - url=disk_url, extra_properties=extra_properties, kernel_image_settings=kernel_image_settings, - ramdisk_image_settings=ramdisk_image_settings, public=public, + return ImageSettings(name=image_name, image_user=image_user, + img_format=image_format, image_file=disk_file, + url=disk_url, extra_properties=extra_properties, + kernel_image_settings=kernel_image_settings, + ramdisk_image_settings=ramdisk_image_settings, + public=public, nic_config_pb_loc=nic_config_pb_loc) -def cirros_image_settings(name=None, url=None, image_metadata=None, kernel_settings=None, ramdisk_settings=None, +def cirros_image_settings(name=None, url=None, image_metadata=None, + kernel_settings=None, ramdisk_settings=None, public=False): """ Returns the image settings for a Cirros QCOW2 image :param name: the name of the image :param url: the image's URL - :param image_metadata: dict() values to override URLs for disk, kernel, and ramdisk - :param kernel_settings: override to the kernel settings from the image_metadata - :param ramdisk_settings: override to the ramdisk settings from the image_metadata - :param public: True denotes image can be used by other projects where False indicates the converse + :param image_metadata: dict() values to override URLs for disk, kernel, and + ramdisk + :param kernel_settings: override to the kernel settings from the + image_metadata + :param ramdisk_settings: override to the ramdisk settings from the + image_metadata + :param public: True denotes image can be used by other projects where False + indicates the converse :return: """ if image_metadata and 'cirros' in image_metadata: @@ -185,25 +219,33 @@ def cirros_image_settings(name=None, url=None, image_metadata=None, kernel_setti metadata = image_metadata return create_image_settings( - image_name=name, image_user=CIRROS_USER, image_format=DEFAULT_IMAGE_FORMAT, metadata=metadata, disk_url=url, + image_name=name, image_user=CIRROS_USER, + image_format=DEFAULT_IMAGE_FORMAT, metadata=metadata, disk_url=url, default_url=CIRROS_DEFAULT_IMAGE_URL, - kernel_settings=kernel_settings, ramdisk_settings=ramdisk_settings, public=public) + kernel_settings=kernel_settings, ramdisk_settings=ramdisk_settings, + public=public) def file_image_test_settings(name, file_path, image_user=CIRROS_USER): - return ImageSettings(name=name, image_user=image_user, img_format=DEFAULT_IMAGE_FORMAT, image_file=file_path) + return ImageSettings(name=name, image_user=image_user, + img_format=DEFAULT_IMAGE_FORMAT, image_file=file_path) -def centos_image_settings(name, url=None, image_metadata=None, kernel_settings=None, ramdisk_settings=None, +def centos_image_settings(name, url=None, image_metadata=None, + kernel_settings=None, ramdisk_settings=None, public=False): """ Returns the image settings for a Centos QCOW2 image :param name: the name of the image :param url: the image's URL - :param image_metadata: dict() values to override URLs for disk, kernel, and ramdisk - :param kernel_settings: override to the kernel settings from the image_metadata - :param ramdisk_settings: override to the ramdisk settings from the image_metadata - :param public: True denotes image can be used by other projects where False indicates the converse + :param image_metadata: dict() values to override URLs for disk, kernel, and + ramdisk + :param kernel_settings: override to the kernel settings from the + image_metadata + :param ramdisk_settings: override to the ramdisk settings from the + image_metadata + :param public: True denotes image can be used by other projects where False + indicates the converse :return: """ if image_metadata and 'centos' in image_metadata: @@ -211,24 +253,32 @@ def centos_image_settings(name, url=None, image_metadata=None, kernel_settings=N else: metadata = image_metadata - pb_path = pkg_resources.resource_filename('snaps.provisioning.ansible.centos-network-setup.playbooks', - 'configure_host.yml') + pb_path = pkg_resources.resource_filename( + 'snaps.provisioning.ansible_pb.centos-network-setup.playbooks', + 'configure_host.yml') return create_image_settings( - image_name=name, image_user=CENTOS_USER, image_format=DEFAULT_IMAGE_FORMAT, metadata=metadata, disk_url=url, + image_name=name, image_user=CENTOS_USER, + image_format=DEFAULT_IMAGE_FORMAT, metadata=metadata, disk_url=url, default_url=CENTOS_DEFAULT_IMAGE_URL, - kernel_settings=kernel_settings, ramdisk_settings=ramdisk_settings, public=public, nic_config_pb_loc=pb_path) + kernel_settings=kernel_settings, ramdisk_settings=ramdisk_settings, + public=public, nic_config_pb_loc=pb_path) -def ubuntu_image_settings(name, url=None, image_metadata=None, kernel_settings=None, ramdisk_settings=None, +def ubuntu_image_settings(name, url=None, image_metadata=None, + kernel_settings=None, ramdisk_settings=None, public=False): """ Returns the image settings for a Ubuntu QCOW2 image :param name: the name of the image :param url: the image's URL - :param image_metadata: dict() values to override URLs for disk, kernel, and ramdisk - :param kernel_settings: override to the kernel settings from the image_metadata - :param ramdisk_settings: override to the ramdisk settings from the image_metadata - :param public: True denotes image can be used by other projects where False indicates the converse + :param image_metadata: dict() values to override URLs for disk, kernel, and + ramdisk + :param kernel_settings: override to the kernel settings from the + image_metadata + :param ramdisk_settings: override to the ramdisk settings from the + image_metadata + :param public: True denotes image can be used by other projects where False + indicates the converse :return: """ if image_metadata and 'ubuntu' in image_metadata: @@ -236,20 +286,27 @@ def ubuntu_image_settings(name, url=None, image_metadata=None, kernel_settings=N else: metadata = image_metadata - pb_path = pkg_resources.resource_filename('snaps.provisioning.ansible.ubuntu-network-setup.playbooks', - 'configure_host.yml') + pb_path = pkg_resources.resource_filename( + 'snaps.provisioning.ansible_pb.ubuntu-network-setup.playbooks', + 'configure_host.yml') return create_image_settings( - image_name=name, image_user=UBUNTU_USER, image_format=DEFAULT_IMAGE_FORMAT, metadata=metadata, disk_url=url, + image_name=name, image_user=UBUNTU_USER, + image_format=DEFAULT_IMAGE_FORMAT, metadata=metadata, disk_url=url, default_url=UBUNTU_DEFAULT_IMAGE_URL, - kernel_settings=kernel_settings, ramdisk_settings=ramdisk_settings, public=public, nic_config_pb_loc=pb_path) + kernel_settings=kernel_settings, ramdisk_settings=ramdisk_settings, + public=public, nic_config_pb_loc=pb_path) -def get_priv_net_config(net_name, subnet_name, router_name=None, cidr='10.55.0.0/24', external_net=None): - return OSNetworkConfig(net_name, subnet_name, cidr, router_name, external_gateway=external_net) +def get_priv_net_config(net_name, subnet_name, router_name=None, + cidr='10.55.0.0/24', external_net=None): + return OSNetworkConfig(net_name, subnet_name, cidr, router_name, + external_gateway=external_net) -def get_pub_net_config(net_name, subnet_name=None, router_name=None, cidr='10.55.1.0/24', external_net=None): - return OSNetworkConfig(net_name, subnet_name, cidr, router_name, external_gateway=external_net) +def get_pub_net_config(net_name, subnet_name=None, router_name=None, + cidr='10.55.1.0/24', external_net=None): + return OSNetworkConfig(net_name, subnet_name, cidr, router_name, + external_gateway=external_net) class OSNetworkConfig: @@ -257,17 +314,21 @@ class OSNetworkConfig: Represents the settings required for the creation of a network in OpenStack """ - def __init__(self, net_name, subnet_name=None, subnet_cidr=None, router_name=None, external_gateway=None): + def __init__(self, net_name, subnet_name=None, subnet_cidr=None, + router_name=None, external_gateway=None): if subnet_name and subnet_cidr: self.network_settings = NetworkSettings( - name=net_name, subnet_settings=[SubnetSettings(cidr=subnet_cidr, name=subnet_name)]) + name=net_name, subnet_settings=[ + SubnetSettings(cidr=subnet_cidr, name=subnet_name)]) else: self.network_settings = NetworkSettings(name=net_name) if router_name: if subnet_name: - self.router_settings = RouterSettings(name=router_name, external_gateway=external_gateway, - internal_subnets=[subnet_name]) + self.router_settings = RouterSettings( + name=router_name, external_gateway=external_gateway, + internal_subnets=[subnet_name]) else: - self.router_settings = RouterSettings(name=router_name, external_gateway=external_gateway) + self.router_settings = RouterSettings( + name=router_name, external_gateway=external_gateway) diff --git a/snaps/provisioning/ansible/__init__.py b/snaps/provisioning/ansible/__init__.py deleted file mode 100644 index e3e876e..0000000 --- a/snaps/provisioning/ansible/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2016 Cable Television Laboratories, Inc. ("CableLabs") -# and others. 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. -__author__ = 'spisarski' diff --git a/snaps/provisioning/ansible/centos-network-setup/__init__.py b/snaps/provisioning/ansible/centos-network-setup/__init__.py deleted file mode 100644 index e3e876e..0000000 --- a/snaps/provisioning/ansible/centos-network-setup/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2016 Cable Television Laboratories, Inc. ("CableLabs") -# and others. 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. -__author__ = 'spisarski' diff --git a/snaps/provisioning/ansible/centos-network-setup/playbooks/__init__.py b/snaps/provisioning/ansible/centos-network-setup/playbooks/__init__.py deleted file mode 100644 index e3e876e..0000000 --- a/snaps/provisioning/ansible/centos-network-setup/playbooks/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2016 Cable Television Laboratories, Inc. ("CableLabs") -# and others. 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. -__author__ = 'spisarski' diff --git a/snaps/provisioning/ansible/ubuntu-network-setup/__init__.py b/snaps/provisioning/ansible/ubuntu-network-setup/__init__.py deleted file mode 100644 index e3e876e..0000000 --- a/snaps/provisioning/ansible/ubuntu-network-setup/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2016 Cable Television Laboratories, Inc. ("CableLabs") -# and others. 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. -__author__ = 'spisarski' diff --git a/snaps/provisioning/ansible/ubuntu-network-setup/playbooks/__init__.py b/snaps/provisioning/ansible/ubuntu-network-setup/playbooks/__init__.py deleted file mode 100644 index e3e876e..0000000 --- a/snaps/provisioning/ansible/ubuntu-network-setup/playbooks/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2016 Cable Television Laboratories, Inc. ("CableLabs") -# and others. 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. -__author__ = 'spisarski' diff --git a/snaps/provisioning/ansible_pb/__init__.py b/snaps/provisioning/ansible_pb/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snaps/provisioning/ansible_pb/__init__.py diff --git a/snaps/provisioning/ansible_pb/centos-network-setup/__init__.py b/snaps/provisioning/ansible_pb/centos-network-setup/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snaps/provisioning/ansible_pb/centos-network-setup/__init__.py diff --git a/snaps/provisioning/ansible_pb/centos-network-setup/playbooks/__init__.py b/snaps/provisioning/ansible_pb/centos-network-setup/playbooks/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snaps/provisioning/ansible_pb/centos-network-setup/playbooks/__init__.py diff --git a/snaps/provisioning/ansible/centos-network-setup/playbooks/configure_host.yml b/snaps/provisioning/ansible_pb/centos-network-setup/playbooks/configure_host.yml index 8df03cb..8df03cb 100644 --- a/snaps/provisioning/ansible/centos-network-setup/playbooks/configure_host.yml +++ b/snaps/provisioning/ansible_pb/centos-network-setup/playbooks/configure_host.yml diff --git a/snaps/provisioning/ansible/centos-network-setup/templates/ifcfg-interface b/snaps/provisioning/ansible_pb/centos-network-setup/templates/ifcfg-interface index 47aa3fa..47aa3fa 100644 --- a/snaps/provisioning/ansible/centos-network-setup/templates/ifcfg-interface +++ b/snaps/provisioning/ansible_pb/centos-network-setup/templates/ifcfg-interface diff --git a/snaps/provisioning/ansible_pb/ubuntu-network-setup/__init__.py b/snaps/provisioning/ansible_pb/ubuntu-network-setup/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snaps/provisioning/ansible_pb/ubuntu-network-setup/__init__.py diff --git a/snaps/provisioning/ansible_pb/ubuntu-network-setup/playbooks/__init__.py b/snaps/provisioning/ansible_pb/ubuntu-network-setup/playbooks/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/snaps/provisioning/ansible_pb/ubuntu-network-setup/playbooks/__init__.py diff --git a/snaps/provisioning/ansible/ubuntu-network-setup/playbooks/configure_host.yml b/snaps/provisioning/ansible_pb/ubuntu-network-setup/playbooks/configure_host.yml index 5d43f96..5d43f96 100644 --- a/snaps/provisioning/ansible/ubuntu-network-setup/playbooks/configure_host.yml +++ b/snaps/provisioning/ansible_pb/ubuntu-network-setup/playbooks/configure_host.yml diff --git a/snaps/provisioning/ansible/ubuntu-network-setup/templates/ethN.cfg b/snaps/provisioning/ansible_pb/ubuntu-network-setup/templates/ethN.cfg index 3fa7708..3fa7708 100644 --- a/snaps/provisioning/ansible/ubuntu-network-setup/templates/ethN.cfg +++ b/snaps/provisioning/ansible_pb/ubuntu-network-setup/templates/ethN.cfg |