def main(): # define available arguments/parameters a user can pass to the module module_args = dict(repo_key=dict(type='str', required=False), repo_address=dict(type='str', required=True), repo_proto=dict(type='str', choices=['http', 'https'], default='http'), repo_port=dict(type='str', required=False), repo_bucket=dict(type='str', required=True), repo_app=dict(type='str', required=True), package_save_location=dict(type='str', required=True)) module = AnsibleModule( argument_spec=module_args, supports_check_mode=True, ) # Init vorteil client vorteil_client = VorteilClient(module) # set repo_cookie if repo_key is provided if module.params['repo_key'] is not None: cookie_response, is_error = vorteil_client.set_repo_cookie() if is_error: module.fail_json(msg="Failed to retrieve cookie", meta=cookie_response) # Pull app package app_package, is_error = vorteil_client.download_app_package() if is_error: module.fail_json(msg="Failed to pull app package", meta=[]) else: module.exit_json(changed=False, response=app_package)
def main(): # define available arguments/parameters a user can pass to the module module_args = dict(repo_key=dict(type='str', required=False), repo_address=dict(type='str', required=True), repo_proto=dict(type='str', choices=['http', 'https'], default='http'), repo_port=dict(type='str', required=False)) module = AnsibleModule( argument_spec=module_args, supports_check_mode=True, ) # Init vorteil client vorteil_client = VorteilClient(module) # set repo_cookie if repo_key is provided if module.params['repo_key'] is not None: cookie_response, is_error = vorteil_client.set_repo_cookie() if is_error: module.fail_json(msg="Failed to retrieve cookie", meta=cookie_response) # Get the list of buckets in the repository bucket_response, is_error = vorteil_client.list_buckets() if is_error: module.fail_json(msg="Failed to retrieve bucket list", meta=bucket_response, exception=traceback.format_exc()) else: module.exit_json(changed=False, response=bucket_response)
def main(): # define available arguments/parameters a user can pass to the module module_args = dict(repo_key=dict(type='str', required=False), repo_address=dict(type='str', required=True), repo_proto=dict(type='str', choices=['http', 'https'], default='http'), repo_port=dict(type='str', required=False)) module = AnsibleModule( argument_spec=module_args, supports_check_mode=True, ) # Init vorteil client vorteil_client = VorteilClient(module) # set repo_cookie if repo_key is provided if module.params['repo_key'] is not None: cookie_response, is_error = vorteil_client.set_repo_cookie() if is_error: module.fail_json(msg="Failed to retrieve cookie", meta=cookie_response) # Create the empty list which we will use to store dictionary objects in list_apps = [] # Get the list of buckets in the repository bucket_response, is_error = vorteil_client.list_buckets() if is_error: module.fail_json(msg="Failed to retrieve bucket list", meta=bucket_response) else: for bucket in bucket_response: # Extract the applications for each of the buckets using the list_apps_in_bucket call module.params['repo_bucket'] = bucket['node']['name'] apps_repsonse, is_error = vorteil_client.list_apps_in_bucket() if is_error: module.fail_json(msg="Failed to retrieve application list", meta=apps_repsonse) else: apps_repsonse['bucket'] = bucket['node']['name'] list_apps.append(apps_repsonse) module.exit_json(changed=False, response=list_apps)
def main(): # define available arguments/parameters a user can pass to the module module_args = dict(repo_key=dict(type='str', required=False), repo_address=dict(type='str', required=True), repo_proto=dict(type='str', choices=['http', 'https'], default='http'), repo_port=dict(type='str', required=False), repo_bucket=dict(type='str', required=True), repo_app=dict(type='str', required=True), injection_uuiduri=dict(type='dict', required=True), repo_disktype=dict(type='str', choices=[ 'gcp', 'ova', 'raw', 'stream-optimized-disk', 'vhd', 'vmdk' ], required=True), disk_directory=dict(type='str', required=True)) module = AnsibleModule( argument_spec=module_args, supports_check_mode=True, ) # Init vorteil client vorteil_client = VorteilClient(module) # set repo_cookie if repo_key is provided if module.params['repo_key'] is not None: cookie_response, is_error = vorteil_client.set_repo_cookie() if is_error: module.fail_json(msg="Failed to retrieve cookie", meta=cookie_response) # Create the injection URI disk_response, is_error = vorteil_client.create_injection_disk() if is_error: module.fail_json(msg="Failed to create the disk from the URI", meta=disk_response) else: module.exit_json(changed=False, response=disk_response)
def main(): # define available arguments/parameters a user can pass to the module module_args = dict(repo_key=dict(type='str', required=False), repo_address=dict(type='str', required=True), repo_proto=dict(type='str', choices=['http', 'https'], default='http'), repo_port=dict(type='str', required=False), repo_provisioner=dict(type='str', required=True), repo_image_name=dict(type='str', required=True), vorteil_germ=dict(type='str', required=True), skip_injection=dict(type='bool', required=False, default=False), wait_until_finished=dict(type='bool', required=False, default=False)) module = AnsibleModule( argument_spec=module_args, supports_check_mode=True, ) # Init vorteil client vorteil_client = VorteilClient(module) # set repo_cookie if repo_key is provided if module.params['repo_key'] is not None: cookie_response, is_error = vorteil_client.set_repo_cookie() if is_error: module.fail_json(msg="Failed to retrieve cookie", meta=cookie_response) # Provision the injection URI from germ uri_response, is_error = vorteil_client.provision_injection_uri_germ() if is_error: module.fail_json(msg="Failed to create the injection URI", meta=uri_response) else: module.exit_json(changed=False, response=uri_response)
def main(): # define available arguments/parameters a user can pass to the module module_args = dict(repo_key=dict(type='str', required=False), repo_address=dict(type='str', required=True), repo_proto=dict(type='str', choices=['http', 'https'], default='http'), repo_port=dict(type='str', required=False), repo_bucket=dict(type='str', required=True), repo_app=dict(type='str', required=True), repo_app_attr=dict(type='list', elements='str', required=False)) module = AnsibleModule( argument_spec=module_args, supports_check_mode=True, ) # Init vorteil client vorteil_client = VorteilClient(module) # set repo_cookie if repo_key is provided if module.params['repo_key'] is not None: cookie_response, is_error = vorteil_client.set_repo_cookie() if is_error: module.fail_json(msg="Failed to retrieve cookie", meta=cookie_response) # Get the list of applications in a specific bucket in the repository app_repsonse, is_error = vorteil_client.get_app() if is_error: module.fail_json(msg="Failed to retrieve application list", meta=app_repsonse) else: module.exit_json(changed=False, response=app_repsonse)
def main(): # define available arguments/parameters a user can pass to the module module_args = dict(repo_key=dict(type='str', required=False), repo_address=dict(type='str', required=True), repo_proto=dict(type='str', choices=['http', 'https'], default='http'), repo_port=dict(type='str', required=False), use_default_kernel=dict(type='bool', default=True, required=False), injection_json=dict(type='dict', required=True), injection_uuiduri=dict(type='dict', required=True)) module = AnsibleModule( argument_spec=module_args, supports_check_mode=True, ) # Init vorteil client vorteil_client = VorteilClient(module) # set repo_cookie if repo_key is provided if module.params['repo_key'] is not None: cookie_response, is_error = vorteil_client.set_repo_cookie() if is_error: module.fail_json(msg="Failed to retrieve cookie", meta=cookie_response) # Provision the injection URI config_response, is_error = vorteil_client.provision_injection_config() if is_error: module.fail_json(msg="Failed to push the configuration to the URI", meta=config_response) else: module.exit_json(changed=False, response=config_response)