From 44fed1d7c1466a13cf11bca19ceb25ac822e7abe Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Wed, 28 Apr 2021 18:13:22 -0400 Subject: [PATCH 01/31] pycharm refactor rename files and class, linux rename tower_ controller_ --- awx_collection/meta/runtime.yml | 141 ++++++++++++++---- .../inventory/{tower.py => controller.py} | 6 +- .../{tower_api.py => controller_api.py} | 6 +- ...er_schedule_rrule.py => schedule_rrule.py} | 0 .../{tower_awxkit.py => awxkit.py} | 6 +- .../{tower_api.py => controller_api.py} | 22 +-- .../{tower_module.py => controller_module.py} | 12 +- .../{tower_legacy.py => legacy.py} | 0 ...er_ad_hoc_command.py => ad_hoc_command.py} | 4 +- ...and_cancel.py => ad_hoc_command_cancel.py} | 4 +- ...command_wait.py => ad_hoc_command_wait.py} | 4 +- .../{tower_application.py => application.py} | 4 +- .../{tower_credential.py => credential.py} | 4 +- ...t_source.py => credential_input_source.py} | 4 +- ..._credential_type.py => credential_type.py} | 4 +- ...nvironment.py => execution_environment.py} | 4 +- .../modules/{tower_export.py => export.py} | 6 +- .../modules/{tower_group.py => group.py} | 4 +- .../modules/{tower_host.py => host.py} | 4 +- .../modules/{tower_import.py => import.py} | 4 +- ...er_instance_group.py => instance_group.py} | 4 +- .../{tower_inventory.py => inventory.py} | 4 +- ...nventory_source.py => inventory_source.py} | 4 +- ...e_update.py => inventory_source_update.py} | 4 +- .../{tower_job_cancel.py => job_cancel.py} | 4 +- .../{tower_job_launch.py => job_launch.py} | 4 +- .../{tower_job_list.py => job_list.py} | 4 +- ...{tower_job_template.py => job_template.py} | 4 +- .../{tower_job_wait.py => job_wait.py} | 4 +- .../modules/{tower_label.py => label.py} | 4 +- .../modules/{tower_license.py => license.py} | 4 +- .../modules/{tower_meta.py => meta.py} | 4 +- ...n_template.py => notification_template.py} | 4 +- ...{tower_organization.py => organization.py} | 4 +- .../modules/{tower_project.py => project.py} | 4 +- ...er_project_update.py => project_update.py} | 4 +- .../modules/{tower_receive.py => receive.py} | 0 .../modules/{tower_role.py => role.py} | 4 +- .../{tower_schedule.py => schedule.py} | 4 +- .../modules/{tower_send.py => send.py} | 0 .../{tower_settings.py => settings.py} | 4 +- .../modules/{tower_team.py => team.py} | 4 +- .../modules/{tower_token.py => token.py} | 4 +- .../modules/{tower_user.py => user.py} | 4 +- ...kflow_approval.py => workflow_approval.py} | 4 +- ...b_template.py => workflow_job_template.py} | 4 +- ..._node.py => workflow_job_template_node.py} | 4 +- ..._workflow_launch.py => workflow_launch.py} | 4 +- ...low_node_wait.py => workflow_node_wait.py} | 4 +- ...kflow_template.py => workflow_template.py} | 0 awx_collection/test/awx/conftest.py | 10 +- awx_collection/test/awx/test_module_utils.py | 12 +- .../tasks/main.yml | 0 .../tasks/main.yml | 0 .../tasks/main.yml | 0 .../tasks/main.yml | 0 .../tasks/main.yml | 0 .../tasks/main.yml | 0 .../tasks/main.yml | 0 .../targets/{tower_export => export}/aliases | 0 .../{tower_export => export}/tasks/main.yml | 0 .../{tower_group => group}/tasks/main.yml | 0 .../{tower_host => host}/tasks/main.yml | 0 .../targets/{tower_import => import}/aliases | 0 .../{tower_import => import}/tasks/main.yml | 0 .../tasks/main.yml | 0 .../tasks/main.yml | 0 .../tasks/main.yml | 0 .../tasks/main.yml | 0 .../tasks/main.yml | 0 .../tasks/main.yml | 0 .../tasks/main.yml | 0 .../tasks/main.yml | 0 .../tasks/main.yml | 0 .../{tower_label => label}/tasks/main.yml | 0 .../tasks/main.yml | 0 .../tasks/main.yml | 0 .../tasks/main.yml | 0 .../{tower_project => project}/tasks/main.yml | 0 .../tasks/create_project_dir.yml | 0 .../tasks/main.yml | 0 .../tasks/main.yml | 0 .../{tower_role => role}/tasks/main.yml | 0 .../tasks/main.yml | 0 .../tasks/main.yml | 0 .../tasks/main.yml | 0 .../{tower_team => team}/tasks/main.yml | 0 .../{tower_token => token}/tasks/main.yml | 0 .../{tower_user => user}/tasks/main.yml | 0 .../tasks/main.yml | 0 .../tasks/main.yml | 0 .../templates/{tower_module.j2 => module.j2} | 0 .../roles/template_galaxy/tasks/main.yml | 10 +- 93 files changed, 234 insertions(+), 149 deletions(-) rename awx_collection/plugins/inventory/{tower.py => controller.py} (96%) rename awx_collection/plugins/lookup/{tower_api.py => controller_api.py} (95%) rename awx_collection/plugins/lookup/{tower_schedule_rrule.py => schedule_rrule.py} (100%) rename awx_collection/plugins/module_utils/{tower_awxkit.py => awxkit.py} (89%) rename awx_collection/plugins/module_utils/{tower_api.py => controller_api.py} (98%) rename awx_collection/plugins/module_utils/{tower_module.py => controller_module.py} (96%) rename awx_collection/plugins/module_utils/{tower_legacy.py => legacy.py} (100%) rename awx_collection/plugins/modules/{tower_ad_hoc_command.py => ad_hoc_command.py} (97%) rename awx_collection/plugins/modules/{tower_ad_hoc_command_cancel.py => ad_hoc_command_cancel.py} (96%) rename awx_collection/plugins/modules/{tower_ad_hoc_command_wait.py => ad_hoc_command_wait.py} (96%) rename awx_collection/plugins/modules/{tower_application.py => application.py} (97%) rename awx_collection/plugins/modules/{tower_credential.py => credential.py} (98%) rename awx_collection/plugins/modules/{tower_credential_input_source.py => credential_input_source.py} (97%) rename awx_collection/plugins/modules/{tower_credential_type.py => credential_type.py} (97%) rename awx_collection/plugins/modules/{tower_execution_environment.py => execution_environment.py} (96%) rename awx_collection/plugins/modules/{tower_export.py => export.py} (96%) rename awx_collection/plugins/modules/{tower_group.py => group.py} (97%) rename awx_collection/plugins/modules/{tower_host.py => host.py} (96%) rename awx_collection/plugins/modules/{tower_import.py => import.py} (95%) rename awx_collection/plugins/modules/{tower_instance_group.py => instance_group.py} (97%) rename awx_collection/plugins/modules/{tower_inventory.py => inventory.py} (98%) rename awx_collection/plugins/modules/{tower_inventory_source.py => inventory_source.py} (98%) rename awx_collection/plugins/modules/{tower_inventory_source_update.py => inventory_source_update.py} (97%) rename awx_collection/plugins/modules/{tower_job_cancel.py => job_cancel.py} (95%) rename awx_collection/plugins/modules/{tower_job_launch.py => job_launch.py} (98%) rename awx_collection/plugins/modules/{tower_job_list.py => job_list.py} (97%) rename awx_collection/plugins/modules/{tower_job_template.py => job_template.py} (99%) rename awx_collection/plugins/modules/{tower_job_wait.py => job_wait.py} (97%) rename awx_collection/plugins/modules/{tower_label.py => label.py} (95%) rename awx_collection/plugins/modules/{tower_license.py => license.py} (96%) rename awx_collection/plugins/modules/{tower_meta.py => meta.py} (94%) rename awx_collection/plugins/modules/{tower_notification_template.py => notification_template.py} (99%) rename awx_collection/plugins/modules/{tower_organization.py => organization.py} (98%) rename awx_collection/plugins/modules/{tower_project.py => project.py} (99%) rename awx_collection/plugins/modules/{tower_project_update.py => project_update.py} (97%) rename awx_collection/plugins/modules/{tower_receive.py => receive.py} (100%) rename awx_collection/plugins/modules/{tower_role.py => role.py} (98%) rename awx_collection/plugins/modules/{tower_schedule.py => schedule.py} (98%) rename awx_collection/plugins/modules/{tower_send.py => send.py} (100%) rename awx_collection/plugins/modules/{tower_settings.py => settings.py} (98%) rename awx_collection/plugins/modules/{tower_team.py => team.py} (96%) rename awx_collection/plugins/modules/{tower_token.py => token.py} (98%) rename awx_collection/plugins/modules/{tower_user.py => user.py} (97%) rename awx_collection/plugins/modules/{tower_workflow_approval.py => workflow_approval.py} (96%) rename awx_collection/plugins/modules/{tower_workflow_job_template.py => workflow_job_template.py} (99%) rename awx_collection/plugins/modules/{tower_workflow_job_template_node.py => workflow_job_template_node.py} (99%) rename awx_collection/plugins/modules/{tower_workflow_launch.py => workflow_launch.py} (98%) rename awx_collection/plugins/modules/{tower_workflow_node_wait.py => workflow_node_wait.py} (95%) rename awx_collection/plugins/modules/{tower_workflow_template.py => workflow_template.py} (100%) rename awx_collection/tests/integration/targets/{tower_ad_hoc_command => ad_hoc_command}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_ad_hoc_command_cancel => ad_hoc_command_cancel}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_ad_hoc_command_wait => ad_hoc_command_wait}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_application => application}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_credential => credential}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_credential_input_source => credential_input_source}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_credential_type => credential_type}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_export => export}/aliases (100%) rename awx_collection/tests/integration/targets/{tower_export => export}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_group => group}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_host => host}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_import => import}/aliases (100%) rename awx_collection/tests/integration/targets/{tower_import => import}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_instance_group => instance_group}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_inventory => inventory}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_inventory_source => inventory_source}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_inventory_source_update => inventory_source_update}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_job_cancel => job_cancel}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_job_launch => job_launch}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_job_list => job_list}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_job_template => job_template}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_job_wait => job_wait}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_label => label}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_lookup_api_plugin => lookup_api_plugin}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_notification_template => notification_template}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_organization => organization}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_project => project}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_project_manual => project_manual}/tasks/create_project_dir.yml (100%) rename awx_collection/tests/integration/targets/{tower_project_manual => project_manual}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_project_update => project_update}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_role => role}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_schedule => schedule}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_schedule_rrule => schedule_rrule}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_settings => settings}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_team => team}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_token => token}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_user => user}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_workflow_job_template => workflow_job_template}/tasks/main.yml (100%) rename awx_collection/tests/integration/targets/{tower_workflow_launch => workflow_launch}/tasks/main.yml (100%) rename awx_collection/tools/roles/generate/templates/{tower_module.j2 => module.j2} (100%) diff --git a/awx_collection/meta/runtime.yml b/awx_collection/meta/runtime.yml index 650f5e4373..b2a565da39 100644 --- a/awx_collection/meta/runtime.yml +++ b/awx_collection/meta/runtime.yml @@ -1,46 +1,131 @@ --- action_groups: - tower: - - tower_credential_input_source - - tower_credential - - tower_credential_type - - tower_group - - tower_host - - tower_inventory - - tower_inventory_source - - tower_job_cancel - - tower_job_launch - - tower_job_list - - tower_job_template - - tower_job_wait - - tower_label - - tower_license - - tower_notification - - tower_organization - - tower_project - - tower_role - - tower_schedule - - tower_settings - - tower_team - - tower_token - - tower_user - - tower_workflow_job_template_node - - tower_workflow_job_template - - tower_workflow_launch + controller: + - credential_input_source + - credential + - credential_type + - group + - host + - inventory + - inventory_source + - job_cancel + - job_launch + - job_list + - job_template + - job_wait + - label + - license + - notification + - organization + - project + - role + - schedule + - settings + - team + - token + - user + - workflow_job_template_node + - workflow_job_template + - workflow_launch plugin_routing: + inventory: + tower: + redirect: awx.awx.controller + lookup: + tower_api: + redirect: awx.awx.controller_api + tower_schedule_rrule: + redirect: awx.awx.schedule_rrule modules: + tower_job_list: + redirect: job_list + tower_job_launch: + redirect: job_launch + tower_workflow_job_template: + redirect: workflow_job_template + tower_team: + redirect: team + tower_job_wait: + redirect: job_wait + tower_application: + redirect: application + tower_ad_hoc_command_wait: + redirect: ad_hoc_command_wait + tower_credential: + redirect: credential + tower_label: + redirect: label + tower_group: + redirect: group + tower_host: + redirect: host + tower_schedule: + redirect: schedule + tower_role: + redirect: role + tower_ad_hoc_command: + redirect: ad_hoc_command + tower_execution_environment: + redirect: execution_environment + tower_inventory_source_update: + redirect: inventory_source_update + tower_instance_group: + redirect: instance_group + tower_settings: + redirect: settings + tower_meta: + redirect: meta + tower_export: + redirect: export + tower_ad_hoc_command_cancel: + redirect: ad_hoc_command_cancel + tower_inventory_source: + redirect: inventory_source + tower_user: + redirect: user + tower_workflow_launch: + redirect: workflow_launch + tower_project: + redirect: project + tower_token: + redirect: token + tower_credential_type: + redirect: credential_type + tower_license: + redirect: license + tower_project_update: + redirect: project_update + tower_notification_template: + redirect: notification_template + tower_organization: + redirect: organization + tower_job_template: + redirect: job_template + tower_workflow_job_template_node: + redirect: workflow_job_template_node + tower_job_cancel: + redirect: job_cancel + tower_import: + redirect: import + tower_credential_input_source: + redirect: credential_input_source + tower_inventory: + redirect: inventory tower_receive: + redirect: receive deprecation: removal_date: TBD warning_text: see plugin documentation for details tower_send: + redirect: send deprecation: removal_date: TBD warning_text: see plugin documentation for details tower_workflow_template: + redirect: workflow_template deprecation: removal_date: TBD warning_text: see plugin documentation for details tower_notification: - redirect: tower_notification_template + redirect: notification_template diff --git a/awx_collection/plugins/inventory/tower.py b/awx_collection/plugins/inventory/controller.py similarity index 96% rename from awx_collection/plugins/inventory/tower.py rename to awx_collection/plugins/inventory/controller.py index b90f7f782c..5c14817707 100644 --- a/awx_collection/plugins/inventory/tower.py +++ b/awx_collection/plugins/inventory/controller.py @@ -72,7 +72,7 @@ from ansible.errors import AnsibleParserError, AnsibleOptionsError from ansible.plugins.inventory import BaseInventoryPlugin from ansible.config.manager import ensure_type -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def handle_error(**kwargs): @@ -104,12 +104,12 @@ class InventoryModule(BaseInventoryPlugin): # Defer processing of params to logic shared with the modules module_params = {} - for plugin_param, module_param in TowerAPIModule.short_params.items(): + for plugin_param, module_param in ControllerAPIModule.short_params.items(): opt_val = self.get_option(plugin_param) if opt_val is not None: module_params[module_param] = opt_val - module = TowerAPIModule(argument_spec={}, direct_params=module_params, error_callback=handle_error, warn_callback=self.warn_callback) + module = ControllerAPIModule(argument_spec={}, direct_params=module_params, error_callback=handle_error, warn_callback=self.warn_callback) # validate type of inventory_id because we allow two types as special case inventory_id = self.get_option('inventory_id') diff --git a/awx_collection/plugins/lookup/tower_api.py b/awx_collection/plugins/lookup/controller_api.py similarity index 95% rename from awx_collection/plugins/lookup/tower_api.py rename to awx_collection/plugins/lookup/controller_api.py index c38b33d139..ee55a200ca 100644 --- a/awx_collection/plugins/lookup/tower_api.py +++ b/awx_collection/plugins/lookup/controller_api.py @@ -120,7 +120,7 @@ from ansible.plugins.lookup import LookupBase from ansible.errors import AnsibleError from ansible.module_utils._text import to_native from ansible.utils.display import Display -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule class LookupModule(LookupBase): @@ -140,13 +140,13 @@ class LookupModule(LookupBase): # Defer processing of params to logic shared with the modules module_params = {} - for plugin_param, module_param in TowerAPIModule.short_params.items(): + for plugin_param, module_param in ControllerAPIModule.short_params.items(): opt_val = self.get_option(plugin_param) if opt_val is not None: module_params[module_param] = opt_val # Create our module - module = TowerAPIModule(argument_spec={}, direct_params=module_params, error_callback=self.handle_error, warn_callback=self.warn_callback) + module = ControllerAPIModule(argument_spec={}, direct_params=module_params, error_callback=self.handle_error, warn_callback=self.warn_callback) response = module.get_endpoint(terms[0], data=self.get_option('query_params', {})) diff --git a/awx_collection/plugins/lookup/tower_schedule_rrule.py b/awx_collection/plugins/lookup/schedule_rrule.py similarity index 100% rename from awx_collection/plugins/lookup/tower_schedule_rrule.py rename to awx_collection/plugins/lookup/schedule_rrule.py diff --git a/awx_collection/plugins/module_utils/tower_awxkit.py b/awx_collection/plugins/module_utils/awxkit.py similarity index 89% rename from awx_collection/plugins/module_utils/tower_awxkit.py rename to awx_collection/plugins/module_utils/awxkit.py index 83bb2990cd..31902e6b15 100644 --- a/awx_collection/plugins/module_utils/tower_awxkit.py +++ b/awx_collection/plugins/module_utils/awxkit.py @@ -2,7 +2,7 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -from .tower_module import TowerModule +from .controller_module import ControllerModule from ansible.module_utils.basic import missing_required_lib try: @@ -15,14 +15,14 @@ except ImportError: HAS_AWX_KIT = False -class TowerAWXKitModule(TowerModule): +class ControllerAWXKitModule(ControllerModule): connection = None apiV2Ref = None def __init__(self, argument_spec, **kwargs): kwargs['supports_check_mode'] = False - super(TowerAWXKitModule, self).__init__(argument_spec=argument_spec, **kwargs) + super(ControllerAWXKitModule, self).__init__(argument_spec=argument_spec, **kwargs) # Die if we don't have AWX_KIT installed if not HAS_AWX_KIT: diff --git a/awx_collection/plugins/module_utils/tower_api.py b/awx_collection/plugins/module_utils/controller_api.py similarity index 98% rename from awx_collection/plugins/module_utils/tower_api.py rename to awx_collection/plugins/module_utils/controller_api.py index ab1b9083a7..0d3aae956e 100644 --- a/awx_collection/plugins/module_utils/tower_api.py +++ b/awx_collection/plugins/module_utils/controller_api.py @@ -2,7 +2,7 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -from .tower_module import TowerModule +from .controller_module import ControllerModule from ansible.module_utils.urls import Request, SSLValidationError, ConnectionError from ansible.module_utils.six import PY2 from ansible.module_utils.six.moves.urllib.error import HTTPError @@ -12,8 +12,8 @@ import time from json import loads, dumps -class TowerAPIModule(TowerModule): - # TODO: Move the collection version check into tower_module.py +class ControllerAPIModule(ControllerModule): + # TODO: Move the collection version check into controller_module.py # This gets set by the make process so whatever is in here is irrelevant _COLLECTION_VERSION = "0.0.1-devel" _COLLECTION_TYPE = "awx" @@ -30,7 +30,7 @@ class TowerAPIModule(TowerModule): def __init__(self, argument_spec, direct_params=None, error_callback=None, warn_callback=None, **kwargs): kwargs['supports_check_mode'] = True - super(TowerAPIModule, self).__init__( + super(ControllerAPIModule, self).__init__( argument_spec=argument_spec, direct_params=direct_params, error_callback=error_callback, warn_callback=warn_callback, **kwargs ) self.session = Request(cookies=CookieJar(), validate_certs=self.verify_ssl) @@ -47,14 +47,14 @@ class TowerAPIModule(TowerModule): @staticmethod def get_name_field_from_endpoint(endpoint): - return TowerAPIModule.IDENTITY_FIELDS.get(endpoint, 'name') + return ControllerAPIModule.IDENTITY_FIELDS.get(endpoint, 'name') def get_item_name(self, item, allow_unknown=False): if item: if 'name' in item: return item['name'] - for field_name in TowerAPIModule.IDENTITY_FIELDS.values(): + for field_name in ControllerAPIModule.IDENTITY_FIELDS.values(): if field_name in item: return item[field_name] @@ -544,13 +544,13 @@ class TowerAPIModule(TowerModule): """ if isinstance(obj, dict): for val in obj.values(): - if TowerAPIModule.has_encrypted_values(val): + if ControllerAPIModule.has_encrypted_values(val): return True elif isinstance(obj, list): for val in obj: - if TowerAPIModule.has_encrypted_values(val): + if ControllerAPIModule.has_encrypted_values(val): return True - elif obj == TowerAPIModule.ENCRYPTED_STRING: + elif obj == ControllerAPIModule.ENCRYPTED_STRING: return True return False @@ -565,11 +565,11 @@ class TowerAPIModule(TowerModule): if set(old_field.keys()) != set(new_field.keys()): return False for key in new_field.keys(): - if not TowerAPIModule.fields_could_be_same(old_field[key], new_field[key]): + if not ControllerAPIModule.fields_could_be_same(old_field[key], new_field[key]): return False return True # all sub-fields are either equal or could be equal else: - if old_field == TowerAPIModule.ENCRYPTED_STRING: + if old_field == ControllerAPIModule.ENCRYPTED_STRING: return True return bool(new_field == old_field) diff --git a/awx_collection/plugins/module_utils/tower_module.py b/awx_collection/plugins/module_utils/controller_module.py similarity index 96% rename from awx_collection/plugins/module_utils/tower_module.py rename to awx_collection/plugins/module_utils/controller_module.py index 60cc44efa5..1f2bed7c33 100644 --- a/awx_collection/plugins/module_utils/tower_module.py +++ b/awx_collection/plugins/module_utils/controller_module.py @@ -29,7 +29,7 @@ class ItemNotDefined(Exception): pass -class TowerModule(AnsibleModule): +class ControllerModule(AnsibleModule): url = None AUTH_ARGSPEC = dict( tower_host=dict(required=False, fallback=(env_fallback, ['TOWER_HOST'])), @@ -60,7 +60,7 @@ class TowerModule(AnsibleModule): def __init__(self, argument_spec=None, direct_params=None, error_callback=None, warn_callback=None, **kwargs): full_argspec = {} - full_argspec.update(TowerModule.AUTH_ARGSPEC) + full_argspec.update(ControllerModule.AUTH_ARGSPEC) full_argspec.update(argument_spec) kwargs['supports_check_mode'] = True @@ -72,7 +72,7 @@ class TowerModule(AnsibleModule): if direct_params is not None: self.params = direct_params else: - super(TowerModule, self).__init__(argument_spec=full_argspec, **kwargs) + super(ControllerModule, self).__init__(argument_spec=full_argspec, **kwargs) self.load_config_files() @@ -242,15 +242,15 @@ class TowerModule(AnsibleModule): if self.error_callback: self.error_callback(**kwargs) else: - super(TowerModule, self).fail_json(**kwargs) + super(ControllerModule, self).fail_json(**kwargs) def exit_json(self, **kwargs): # Try to log out if we are authenticated self.logout() - super(TowerModule, self).exit_json(**kwargs) + super(ControllerModule, self).exit_json(**kwargs) def warn(self, warning): if self.warn_callback is not None: self.warn_callback(warning) else: - super(TowerModule, self).warn(warning) + super(ControllerModule, self).warn(warning) diff --git a/awx_collection/plugins/module_utils/tower_legacy.py b/awx_collection/plugins/module_utils/legacy.py similarity index 100% rename from awx_collection/plugins/module_utils/tower_legacy.py rename to awx_collection/plugins/module_utils/legacy.py diff --git a/awx_collection/plugins/modules/tower_ad_hoc_command.py b/awx_collection/plugins/modules/ad_hoc_command.py similarity index 97% rename from awx_collection/plugins/modules/tower_ad_hoc_command.py rename to awx_collection/plugins/modules/ad_hoc_command.py index 3926df9471..97f2d1072f 100644 --- a/awx_collection/plugins/modules/tower_ad_hoc_command.py +++ b/awx_collection/plugins/modules/ad_hoc_command.py @@ -111,7 +111,7 @@ status: sample: pending ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -135,7 +135,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters inventory = module.params.get('inventory') diff --git a/awx_collection/plugins/modules/tower_ad_hoc_command_cancel.py b/awx_collection/plugins/modules/ad_hoc_command_cancel.py similarity index 96% rename from awx_collection/plugins/modules/tower_ad_hoc_command_cancel.py rename to awx_collection/plugins/modules/ad_hoc_command_cancel.py index c909250e4f..400ef4af9b 100644 --- a/awx_collection/plugins/modules/tower_ad_hoc_command_cancel.py +++ b/awx_collection/plugins/modules/ad_hoc_command_cancel.py @@ -62,7 +62,7 @@ id: import time -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -75,7 +75,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters command_id = module.params.get('command_id') diff --git a/awx_collection/plugins/modules/tower_ad_hoc_command_wait.py b/awx_collection/plugins/modules/ad_hoc_command_wait.py similarity index 96% rename from awx_collection/plugins/modules/tower_ad_hoc_command_wait.py rename to awx_collection/plugins/modules/ad_hoc_command_wait.py index 13f890c33e..21f4e9b348 100644 --- a/awx_collection/plugins/modules/tower_ad_hoc_command_wait.py +++ b/awx_collection/plugins/modules/ad_hoc_command_wait.py @@ -82,7 +82,7 @@ status: ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -94,7 +94,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters command_id = module.params.get('command_id') diff --git a/awx_collection/plugins/modules/tower_application.py b/awx_collection/plugins/modules/application.py similarity index 97% rename from awx_collection/plugins/modules/tower_application.py rename to awx_collection/plugins/modules/application.py index 5841c74318..8fcf4f79dd 100644 --- a/awx_collection/plugins/modules/tower_application.py +++ b/awx_collection/plugins/modules/application.py @@ -91,7 +91,7 @@ EXAMPLES = ''' import time -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -108,7 +108,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_credential.py b/awx_collection/plugins/modules/credential.py similarity index 98% rename from awx_collection/plugins/modules/tower_credential.py rename to awx_collection/plugins/modules/credential.py index ad09769d2c..46e2c712dd 100644 --- a/awx_collection/plugins/modules/tower_credential.py +++ b/awx_collection/plugins/modules/credential.py @@ -289,7 +289,7 @@ EXAMPLES = ''' organization: Foo ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule KIND_CHOICES = { 'aws': 'Amazon Web Services', @@ -378,7 +378,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec, required_one_of=[['kind', 'credential_type']]) + module = ControllerAPIModule(argument_spec=argument_spec, required_one_of=[['kind', 'credential_type']]) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_credential_input_source.py b/awx_collection/plugins/modules/credential_input_source.py similarity index 97% rename from awx_collection/plugins/modules/tower_credential_input_source.py rename to awx_collection/plugins/modules/credential_input_source.py index 2fa32d612c..9e4303a5bd 100644 --- a/awx_collection/plugins/modules/tower_credential_input_source.py +++ b/awx_collection/plugins/modules/credential_input_source.py @@ -69,7 +69,7 @@ EXAMPLES = ''' ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -84,7 +84,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters description = module.params.get('description') diff --git a/awx_collection/plugins/modules/tower_credential_type.py b/awx_collection/plugins/modules/credential_type.py similarity index 97% rename from awx_collection/plugins/modules/tower_credential_type.py rename to awx_collection/plugins/modules/credential_type.py index d960f47603..af0869d2c4 100644 --- a/awx_collection/plugins/modules/tower_credential_type.py +++ b/awx_collection/plugins/modules/credential_type.py @@ -80,7 +80,7 @@ EXAMPLES = ''' RETURN = ''' # ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule KIND_CHOICES = {'ssh': 'Machine', 'vault': 'Ansible Vault', 'net': 'Network', 'scm': 'Source Control', 'cloud': 'Lots of others', 'insights': 'Insights'} @@ -97,7 +97,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_execution_environment.py b/awx_collection/plugins/modules/execution_environment.py similarity index 96% rename from awx_collection/plugins/modules/tower_execution_environment.py rename to awx_collection/plugins/modules/execution_environment.py index 4200016132..fc9ecc19a0 100644 --- a/awx_collection/plugins/modules/tower_execution_environment.py +++ b/awx_collection/plugins/modules/execution_environment.py @@ -67,7 +67,7 @@ EXAMPLES = ''' ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule import json @@ -84,7 +84,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_export.py b/awx_collection/plugins/modules/export.py similarity index 96% rename from awx_collection/plugins/modules/tower_export.py rename to awx_collection/plugins/modules/export.py index 4e6b3b9a3a..370ff8e685 100644 --- a/awx_collection/plugins/modules/tower_export.py +++ b/awx_collection/plugins/modules/export.py @@ -99,7 +99,7 @@ EXAMPLES = ''' from os import environ import logging from ansible.module_utils.six.moves import StringIO -from ..module_utils.tower_awxkit import TowerAWXKitModule +from ..module_utils.awxkit import ControllerAWXKitModule try: from awxkit.api.pages.api import EXPORTABLE_RESOURCES @@ -114,12 +114,12 @@ def main(): all=dict(type='bool', default=False), ) - # We are not going to raise an error here because the __init__ method of TowerAWXKitModule will do that for us + # We are not going to raise an error here because the __init__ method of ControllerAWXKitModule will do that for us if HAS_EXPORTABLE_RESOURCES: for resource in EXPORTABLE_RESOURCES: argument_spec[resource] = dict(type='str') - module = TowerAWXKitModule(argument_spec=argument_spec) + module = ControllerAWXKitModule(argument_spec=argument_spec) if not HAS_EXPORTABLE_RESOURCES: module.fail_json(msg="Your version of awxkit does not have import/export") diff --git a/awx_collection/plugins/modules/tower_group.py b/awx_collection/plugins/modules/group.py similarity index 97% rename from awx_collection/plugins/modules/tower_group.py rename to awx_collection/plugins/modules/group.py index 4c1674bb7c..f7785da2be 100644 --- a/awx_collection/plugins/modules/tower_group.py +++ b/awx_collection/plugins/modules/group.py @@ -99,7 +99,7 @@ EXAMPLES = ''' preserve_existing_children: True ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule import json @@ -119,7 +119,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_host.py b/awx_collection/plugins/modules/host.py similarity index 96% rename from awx_collection/plugins/modules/tower_host.py rename to awx_collection/plugins/modules/host.py index c56d5f877d..d5e711dd93 100644 --- a/awx_collection/plugins/modules/tower_host.py +++ b/awx_collection/plugins/modules/host.py @@ -71,7 +71,7 @@ EXAMPLES = ''' ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule import json @@ -88,7 +88,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_import.py b/awx_collection/plugins/modules/import.py similarity index 95% rename from awx_collection/plugins/modules/tower_import.py rename to awx_collection/plugins/modules/import.py index 76169f88ba..89142532ad 100644 --- a/awx_collection/plugins/modules/tower_import.py +++ b/awx_collection/plugins/modules/import.py @@ -48,7 +48,7 @@ EXAMPLES = ''' assets: "{{ lookup('file', 'org.json') | from_json() }}" ''' -from ..module_utils.tower_awxkit import TowerAWXKitModule +from ..module_utils.awxkit import ControllerAWXKitModule # These two lines are not needed if awxkit changes to do programatic notifications on issues from ansible.module_utils.six.moves import StringIO @@ -66,7 +66,7 @@ except ImportError: def main(): argument_spec = dict(assets=dict(type='dict', required=True)) - module = TowerAWXKitModule(argument_spec=argument_spec, supports_check_mode=False) + module = ControllerAWXKitModule(argument_spec=argument_spec, supports_check_mode=False) assets = module.params.get('assets') diff --git a/awx_collection/plugins/modules/tower_instance_group.py b/awx_collection/plugins/modules/instance_group.py similarity index 97% rename from awx_collection/plugins/modules/tower_instance_group.py rename to awx_collection/plugins/modules/instance_group.py index 4ec76174d3..65f0d27ee8 100644 --- a/awx_collection/plugins/modules/tower_instance_group.py +++ b/awx_collection/plugins/modules/instance_group.py @@ -80,7 +80,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -99,7 +99,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_inventory.py b/awx_collection/plugins/modules/inventory.py similarity index 98% rename from awx_collection/plugins/modules/tower_inventory.py rename to awx_collection/plugins/modules/inventory.py index 3e9f3613df..25b75358f3 100644 --- a/awx_collection/plugins/modules/tower_inventory.py +++ b/awx_collection/plugins/modules/inventory.py @@ -95,7 +95,7 @@ EXAMPLES = ''' ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule import json @@ -115,7 +115,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_inventory_source.py b/awx_collection/plugins/modules/inventory_source.py similarity index 98% rename from awx_collection/plugins/modules/tower_inventory_source.py rename to awx_collection/plugins/modules/inventory_source.py index 4cb1581ec9..4ab2dd192f 100644 --- a/awx_collection/plugins/modules/tower_inventory_source.py +++ b/awx_collection/plugins/modules/inventory_source.py @@ -150,7 +150,7 @@ EXAMPLES = ''' private: false ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule from json import dumps @@ -189,7 +189,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_inventory_source_update.py b/awx_collection/plugins/modules/inventory_source_update.py similarity index 97% rename from awx_collection/plugins/modules/tower_inventory_source_update.py rename to awx_collection/plugins/modules/inventory_source_update.py index 9026720fd5..703c3ca4e7 100644 --- a/awx_collection/plugins/modules/tower_inventory_source_update.py +++ b/awx_collection/plugins/modules/inventory_source_update.py @@ -83,7 +83,7 @@ status: sample: pending ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -98,7 +98,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_job_cancel.py b/awx_collection/plugins/modules/job_cancel.py similarity index 95% rename from awx_collection/plugins/modules/tower_job_cancel.py rename to awx_collection/plugins/modules/job_cancel.py index 4e1fdbf620..c56a4efa3f 100644 --- a/awx_collection/plugins/modules/tower_job_cancel.py +++ b/awx_collection/plugins/modules/job_cancel.py @@ -49,7 +49,7 @@ id: ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -60,7 +60,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters job_id = module.params.get('job_id') diff --git a/awx_collection/plugins/modules/tower_job_launch.py b/awx_collection/plugins/modules/job_launch.py similarity index 98% rename from awx_collection/plugins/modules/tower_job_launch.py rename to awx_collection/plugins/modules/job_launch.py index 801a4cfc85..e211d5654a 100644 --- a/awx_collection/plugins/modules/tower_job_launch.py +++ b/awx_collection/plugins/modules/job_launch.py @@ -145,7 +145,7 @@ status: sample: pending ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -171,7 +171,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) optional_args = {} # Extract our parameters diff --git a/awx_collection/plugins/modules/tower_job_list.py b/awx_collection/plugins/modules/job_list.py similarity index 97% rename from awx_collection/plugins/modules/tower_job_list.py rename to awx_collection/plugins/modules/job_list.py index 0bbb79c7e1..43a454a5da 100644 --- a/awx_collection/plugins/modules/tower_job_list.py +++ b/awx_collection/plugins/modules/job_list.py @@ -79,7 +79,7 @@ results: ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -92,7 +92,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule( + module = ControllerAPIModule( argument_spec=argument_spec, mutually_exclusive=[ ('page', 'all_pages'), diff --git a/awx_collection/plugins/modules/tower_job_template.py b/awx_collection/plugins/modules/job_template.py similarity index 99% rename from awx_collection/plugins/modules/tower_job_template.py rename to awx_collection/plugins/modules/job_template.py index 09387c6386..8cf6ae8b9a 100644 --- a/awx_collection/plugins/modules/tower_job_template.py +++ b/awx_collection/plugins/modules/job_template.py @@ -343,7 +343,7 @@ EXAMPLES = ''' state: "present" ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule import json @@ -417,7 +417,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_job_wait.py b/awx_collection/plugins/modules/job_wait.py similarity index 97% rename from awx_collection/plugins/modules/tower_job_wait.py rename to awx_collection/plugins/modules/job_wait.py index 3c77e3f354..52ab4a8dd4 100644 --- a/awx_collection/plugins/modules/tower_job_wait.py +++ b/awx_collection/plugins/modules/job_wait.py @@ -97,7 +97,7 @@ status: ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -112,7 +112,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters job_id = module.params.get('job_id') diff --git a/awx_collection/plugins/modules/tower_label.py b/awx_collection/plugins/modules/label.py similarity index 95% rename from awx_collection/plugins/modules/tower_label.py rename to awx_collection/plugins/modules/label.py index 52a67ed64f..e231f4848b 100644 --- a/awx_collection/plugins/modules/tower_label.py +++ b/awx_collection/plugins/modules/label.py @@ -53,7 +53,7 @@ EXAMPLES = ''' organization: My Organization ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -66,7 +66,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_license.py b/awx_collection/plugins/modules/license.py similarity index 96% rename from awx_collection/plugins/modules/tower_license.py rename to awx_collection/plugins/modules/license.py index 90439b0a08..185aa7dfc7 100644 --- a/awx_collection/plugins/modules/tower_license.py +++ b/awx_collection/plugins/modules/license.py @@ -44,12 +44,12 @@ EXAMPLES = ''' ''' import base64 -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): - module = TowerAPIModule( + module = ControllerAPIModule( argument_spec=dict( manifest=dict(type='str', required=True), force=dict(type='bool', required=False), diff --git a/awx_collection/plugins/modules/tower_meta.py b/awx_collection/plugins/modules/meta.py similarity index 94% rename from awx_collection/plugins/modules/tower_meta.py rename to awx_collection/plugins/modules/meta.py index a62c3f5113..cc742f20de 100644 --- a/awx_collection/plugins/modules/tower_meta.py +++ b/awx_collection/plugins/modules/meta.py @@ -61,11 +61,11 @@ EXAMPLES = ''' ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): - module = TowerAPIModule(argument_spec={}) + module = ControllerAPIModule(argument_spec={}) namespace = {'awx': 'awx', 'tower': 'ansible'}.get(module._COLLECTION_TYPE, 'unknown') namespace_name = '{0}.{1}'.format(namespace, module._COLLECTION_TYPE) module.exit_json(prefix=namespace_name, name=module._COLLECTION_TYPE, namespace=namespace, version=module._COLLECTION_VERSION) diff --git a/awx_collection/plugins/modules/tower_notification_template.py b/awx_collection/plugins/modules/notification_template.py similarity index 99% rename from awx_collection/plugins/modules/tower_notification_template.py rename to awx_collection/plugins/modules/notification_template.py index 6d2af69a97..11a24abe3b 100644 --- a/awx_collection/plugins/modules/tower_notification_template.py +++ b/awx_collection/plugins/modules/notification_template.py @@ -313,7 +313,7 @@ EXAMPLES = ''' RETURN = ''' # ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule OLD_INPUT_NAMES = ( 'username', @@ -384,7 +384,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_organization.py b/awx_collection/plugins/modules/organization.py similarity index 98% rename from awx_collection/plugins/modules/tower_organization.py rename to awx_collection/plugins/modules/organization.py index a919e53c67..b7206e4a1d 100644 --- a/awx_collection/plugins/modules/tower_organization.py +++ b/awx_collection/plugins/modules/organization.py @@ -109,7 +109,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -130,7 +130,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_project.py b/awx_collection/plugins/modules/project.py similarity index 99% rename from awx_collection/plugins/modules/tower_project.py rename to awx_collection/plugins/modules/project.py index a3f7820b81..98e7e34691 100644 --- a/awx_collection/plugins/modules/tower_project.py +++ b/awx_collection/plugins/modules/project.py @@ -199,7 +199,7 @@ EXAMPLES = ''' import time -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def wait_for_project_update(module, last_request): @@ -280,7 +280,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_project_update.py b/awx_collection/plugins/modules/project_update.py similarity index 97% rename from awx_collection/plugins/modules/tower_project_update.py rename to awx_collection/plugins/modules/project_update.py index 796f910df7..0371343734 100644 --- a/awx_collection/plugins/modules/tower_project_update.py +++ b/awx_collection/plugins/modules/project_update.py @@ -77,7 +77,7 @@ EXAMPLES = ''' wait: False ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule import json import time @@ -93,7 +93,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_receive.py b/awx_collection/plugins/modules/receive.py similarity index 100% rename from awx_collection/plugins/modules/tower_receive.py rename to awx_collection/plugins/modules/receive.py diff --git a/awx_collection/plugins/modules/tower_role.py b/awx_collection/plugins/modules/role.py similarity index 98% rename from awx_collection/plugins/modules/tower_role.py rename to awx_collection/plugins/modules/role.py index 2b73f8eab4..5cfda7fa48 100644 --- a/awx_collection/plugins/modules/tower_role.py +++ b/awx_collection/plugins/modules/role.py @@ -148,7 +148,7 @@ EXAMPLES = ''' state: present ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -194,7 +194,7 @@ def main(): state=dict(choices=['present', 'absent'], default='present'), ) - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) role_type = module.params.pop('role') role_field = role_type + '_role' diff --git a/awx_collection/plugins/modules/tower_schedule.py b/awx_collection/plugins/modules/schedule.py similarity index 98% rename from awx_collection/plugins/modules/tower_schedule.py rename to awx_collection/plugins/modules/schedule.py index 921b8e8761..33f1a4b4bb 100644 --- a/awx_collection/plugins/modules/tower_schedule.py +++ b/awx_collection/plugins/modules/schedule.py @@ -135,7 +135,7 @@ EXAMPLES = ''' register: result ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -160,7 +160,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters rrule = module.params.get('rrule') diff --git a/awx_collection/plugins/modules/tower_send.py b/awx_collection/plugins/modules/send.py similarity index 100% rename from awx_collection/plugins/modules/tower_send.py rename to awx_collection/plugins/modules/send.py diff --git a/awx_collection/plugins/modules/tower_settings.py b/awx_collection/plugins/modules/settings.py similarity index 98% rename from awx_collection/plugins/modules/tower_settings.py rename to awx_collection/plugins/modules/settings.py index 18531a28d7..4cfbc2aae3 100644 --- a/awx_collection/plugins/modules/tower_settings.py +++ b/awx_collection/plugins/modules/settings.py @@ -69,7 +69,7 @@ EXAMPLES = ''' last_name: "surname" ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule try: import yaml @@ -107,7 +107,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule( + module = ControllerAPIModule( argument_spec=argument_spec, required_one_of=[['name', 'settings']], mutually_exclusive=[['name', 'settings']], diff --git a/awx_collection/plugins/modules/tower_team.py b/awx_collection/plugins/modules/team.py similarity index 96% rename from awx_collection/plugins/modules/tower_team.py rename to awx_collection/plugins/modules/team.py index a060223f61..d47e41d79a 100644 --- a/awx_collection/plugins/modules/tower_team.py +++ b/awx_collection/plugins/modules/team.py @@ -59,7 +59,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -73,7 +73,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_token.py b/awx_collection/plugins/modules/token.py similarity index 98% rename from awx_collection/plugins/modules/tower_token.py rename to awx_collection/plugins/modules/token.py index 541a6c7dd1..85ac7f04c8 100644 --- a/awx_collection/plugins/modules/tower_token.py +++ b/awx_collection/plugins/modules/token.py @@ -116,7 +116,7 @@ tower_token: returned: on successful create ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def return_token(module, last_response): @@ -142,7 +142,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule( + module = ControllerAPIModule( argument_spec=argument_spec, mutually_exclusive=[ ('existing_token', 'existing_token_id'), diff --git a/awx_collection/plugins/modules/tower_user.py b/awx_collection/plugins/modules/user.py similarity index 97% rename from awx_collection/plugins/modules/tower_user.py rename to awx_collection/plugins/modules/user.py index 871ca872ac..d1ab5841ea 100644 --- a/awx_collection/plugins/modules/tower_user.py +++ b/awx_collection/plugins/modules/user.py @@ -107,7 +107,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -125,7 +125,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters username = module.params.get('username') diff --git a/awx_collection/plugins/modules/tower_workflow_approval.py b/awx_collection/plugins/modules/workflow_approval.py similarity index 96% rename from awx_collection/plugins/modules/tower_workflow_approval.py rename to awx_collection/plugins/modules/workflow_approval.py index 3bbd318db6..c4de175b80 100644 --- a/awx_collection/plugins/modules/tower_workflow_approval.py +++ b/awx_collection/plugins/modules/workflow_approval.py @@ -77,7 +77,7 @@ RETURN = """ """ -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -91,7 +91,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters workflow_job_id = module.params.get("workflow_job_id") diff --git a/awx_collection/plugins/modules/tower_workflow_job_template.py b/awx_collection/plugins/modules/workflow_job_template.py similarity index 99% rename from awx_collection/plugins/modules/tower_workflow_job_template.py rename to awx_collection/plugins/modules/workflow_job_template.py index 061b3912be..3f9c7aa183 100644 --- a/awx_collection/plugins/modules/tower_workflow_job_template.py +++ b/awx_collection/plugins/modules/workflow_job_template.py @@ -455,7 +455,7 @@ EXAMPLES = ''' ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule import json @@ -689,7 +689,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_workflow_job_template_node.py b/awx_collection/plugins/modules/workflow_job_template_node.py similarity index 99% rename from awx_collection/plugins/modules/tower_workflow_job_template_node.py rename to awx_collection/plugins/modules/workflow_job_template_node.py index b878af8d53..bb05449bbf 100644 --- a/awx_collection/plugins/modules/tower_workflow_job_template_node.py +++ b/awx_collection/plugins/modules/workflow_job_template_node.py @@ -224,7 +224,7 @@ EXAMPLES = ''' - my-third-node ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -259,7 +259,7 @@ def main(): ] # Create a module for ourselves - module = TowerAPIModule( + module = ControllerAPIModule( argument_spec=argument_spec, mutually_exclusive=mutually_exclusive, required_if=required_if, diff --git a/awx_collection/plugins/modules/tower_workflow_launch.py b/awx_collection/plugins/modules/workflow_launch.py similarity index 98% rename from awx_collection/plugins/modules/tower_workflow_launch.py rename to awx_collection/plugins/modules/workflow_launch.py index cee0c2c649..40f8c37717 100644 --- a/awx_collection/plugins/modules/tower_workflow_launch.py +++ b/awx_collection/plugins/modules/workflow_launch.py @@ -90,7 +90,7 @@ EXAMPLES = ''' wait: False ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule import json @@ -109,7 +109,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) optional_args = {} # Extract our parameters diff --git a/awx_collection/plugins/modules/tower_workflow_node_wait.py b/awx_collection/plugins/modules/workflow_node_wait.py similarity index 95% rename from awx_collection/plugins/modules/tower_workflow_node_wait.py rename to awx_collection/plugins/modules/workflow_node_wait.py index 1510b4f43f..2e2e06ee35 100644 --- a/awx_collection/plugins/modules/tower_workflow_node_wait.py +++ b/awx_collection/plugins/modules/workflow_node_wait.py @@ -69,7 +69,7 @@ RETURN = """ """ -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule import time @@ -83,7 +83,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters workflow_job_id = module.params.get("workflow_job_id") diff --git a/awx_collection/plugins/modules/tower_workflow_template.py b/awx_collection/plugins/modules/workflow_template.py similarity index 100% rename from awx_collection/plugins/modules/tower_workflow_template.py rename to awx_collection/plugins/modules/workflow_template.py diff --git a/awx_collection/test/awx/conftest.py b/awx_collection/test/awx/conftest.py index 8b5ba3ace1..515114d2ca 100644 --- a/awx_collection/test/awx/conftest.py +++ b/awx_collection/test/awx/conftest.py @@ -150,14 +150,14 @@ def run_module(request, collection_import): def mock_load_params(self): self.params = module_params - if getattr(resource_module, 'TowerAWXKitModule', None): - resource_class = resource_module.TowerAWXKitModule - elif getattr(resource_module, 'TowerAPIModule', None): - resource_class = resource_module.TowerAPIModule + if getattr(resource_module, 'ControllerAWXKitModule', None): + resource_class = resource_module.ControllerAWXKitModule + elif getattr(resource_module, 'ControllerAPIModule', None): + resource_class = resource_module.ControllerAPIModule elif getattr(resource_module, 'TowerLegacyModule', None): resource_class = resource_module.TowerLegacyModule else: - raise ("The module has neither a TowerLegacyModule, TowerAWXKitModule or a TowerAPIModule") + raise ("The module has neither a TowerLegacyModule, ControllerAWXKitModule or a ControllerAPIModule") with mock.patch.object(resource_class, '_load_params', new=mock_load_params): # Call the test utility (like a mock server) instead of issuing HTTP requests diff --git a/awx_collection/test/awx/test_module_utils.py b/awx_collection/test/awx/test_module_utils.py index a215db35fc..71c03bd7e6 100644 --- a/awx_collection/test/awx/test_module_utils.py +++ b/awx_collection/test/awx/test_module_utils.py @@ -49,7 +49,7 @@ def mock_awx_ping_response(self, method, url, **kwargs): def test_version_warning(collection_import, silence_warning): - TowerAPIModule = collection_import('plugins.module_utils.tower_api').TowerAPIModule + TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule cli_data = {'ANSIBLE_MODULE_ARGS': {}} testargs = ['module_file2.py', json.dumps(cli_data)] with mock.patch.object(sys, 'argv', testargs): @@ -64,7 +64,7 @@ def test_version_warning(collection_import, silence_warning): def test_version_warning_strictness_awx(collection_import, silence_warning): - TowerAPIModule = collection_import('plugins.module_utils.tower_api').TowerAPIModule + TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule cli_data = {'ANSIBLE_MODULE_ARGS': {}} testargs = ['module_file2.py', json.dumps(cli_data)] # Compare 1.0.0 to 1.2.3 (major matches) @@ -87,7 +87,7 @@ def test_version_warning_strictness_awx(collection_import, silence_warning): def test_version_warning_strictness_tower(collection_import, silence_warning): - TowerAPIModule = collection_import('plugins.module_utils.tower_api').TowerAPIModule + TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule cli_data = {'ANSIBLE_MODULE_ARGS': {}} testargs = ['module_file2.py', json.dumps(cli_data)] # Compare 1.2.0 to 1.2.3 (major/minor matches) @@ -112,7 +112,7 @@ def test_version_warning_strictness_tower(collection_import, silence_warning): def test_type_warning(collection_import, silence_warning): - TowerAPIModule = collection_import('plugins.module_utils.tower_api').TowerAPIModule + TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule cli_data = {'ANSIBLE_MODULE_ARGS': {}} testargs = ['module_file2.py', json.dumps(cli_data)] with mock.patch.object(sys, 'argv', testargs): @@ -128,7 +128,7 @@ def test_type_warning(collection_import, silence_warning): def test_duplicate_config(collection_import, silence_warning): # imports done here because of PATH issues unique to this test suite - TowerAPIModule = collection_import('plugins.module_utils.tower_api').TowerAPIModule + TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule data = {'name': 'zigzoom', 'zig': 'zoom', 'tower_username': 'bob', 'tower_config_file': 'my_config'} with mock.patch.object(TowerAPIModule, 'load_config') as mock_load: @@ -152,7 +152,7 @@ def test_no_templated_values(collection_import): Those replacements should happen at build time, so they should not be checked into source. """ - TowerAPIModule = collection_import('plugins.module_utils.tower_api').TowerAPIModule + TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule assert TowerAPIModule._COLLECTION_VERSION == "0.0.1-devel", ( 'The collection version is templated when the collection is built ' 'and the code should retain the placeholder of "0.0.1-devel".' ) diff --git a/awx_collection/tests/integration/targets/tower_ad_hoc_command/tasks/main.yml b/awx_collection/tests/integration/targets/ad_hoc_command/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_ad_hoc_command/tasks/main.yml rename to awx_collection/tests/integration/targets/ad_hoc_command/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_ad_hoc_command_cancel/tasks/main.yml b/awx_collection/tests/integration/targets/ad_hoc_command_cancel/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_ad_hoc_command_cancel/tasks/main.yml rename to awx_collection/tests/integration/targets/ad_hoc_command_cancel/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_ad_hoc_command_wait/tasks/main.yml b/awx_collection/tests/integration/targets/ad_hoc_command_wait/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_ad_hoc_command_wait/tasks/main.yml rename to awx_collection/tests/integration/targets/ad_hoc_command_wait/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_application/tasks/main.yml b/awx_collection/tests/integration/targets/application/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_application/tasks/main.yml rename to awx_collection/tests/integration/targets/application/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_credential/tasks/main.yml b/awx_collection/tests/integration/targets/credential/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_credential/tasks/main.yml rename to awx_collection/tests/integration/targets/credential/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_credential_input_source/tasks/main.yml b/awx_collection/tests/integration/targets/credential_input_source/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_credential_input_source/tasks/main.yml rename to awx_collection/tests/integration/targets/credential_input_source/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_credential_type/tasks/main.yml b/awx_collection/tests/integration/targets/credential_type/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_credential_type/tasks/main.yml rename to awx_collection/tests/integration/targets/credential_type/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_export/aliases b/awx_collection/tests/integration/targets/export/aliases similarity index 100% rename from awx_collection/tests/integration/targets/tower_export/aliases rename to awx_collection/tests/integration/targets/export/aliases diff --git a/awx_collection/tests/integration/targets/tower_export/tasks/main.yml b/awx_collection/tests/integration/targets/export/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_export/tasks/main.yml rename to awx_collection/tests/integration/targets/export/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_group/tasks/main.yml b/awx_collection/tests/integration/targets/group/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_group/tasks/main.yml rename to awx_collection/tests/integration/targets/group/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_host/tasks/main.yml b/awx_collection/tests/integration/targets/host/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_host/tasks/main.yml rename to awx_collection/tests/integration/targets/host/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_import/aliases b/awx_collection/tests/integration/targets/import/aliases similarity index 100% rename from awx_collection/tests/integration/targets/tower_import/aliases rename to awx_collection/tests/integration/targets/import/aliases diff --git a/awx_collection/tests/integration/targets/tower_import/tasks/main.yml b/awx_collection/tests/integration/targets/import/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_import/tasks/main.yml rename to awx_collection/tests/integration/targets/import/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_instance_group/tasks/main.yml b/awx_collection/tests/integration/targets/instance_group/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_instance_group/tasks/main.yml rename to awx_collection/tests/integration/targets/instance_group/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_inventory/tasks/main.yml b/awx_collection/tests/integration/targets/inventory/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_inventory/tasks/main.yml rename to awx_collection/tests/integration/targets/inventory/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_inventory_source/tasks/main.yml b/awx_collection/tests/integration/targets/inventory_source/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_inventory_source/tasks/main.yml rename to awx_collection/tests/integration/targets/inventory_source/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_inventory_source_update/tasks/main.yml b/awx_collection/tests/integration/targets/inventory_source_update/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_inventory_source_update/tasks/main.yml rename to awx_collection/tests/integration/targets/inventory_source_update/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_job_cancel/tasks/main.yml b/awx_collection/tests/integration/targets/job_cancel/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_job_cancel/tasks/main.yml rename to awx_collection/tests/integration/targets/job_cancel/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_job_launch/tasks/main.yml b/awx_collection/tests/integration/targets/job_launch/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_job_launch/tasks/main.yml rename to awx_collection/tests/integration/targets/job_launch/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_job_list/tasks/main.yml b/awx_collection/tests/integration/targets/job_list/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_job_list/tasks/main.yml rename to awx_collection/tests/integration/targets/job_list/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_job_template/tasks/main.yml b/awx_collection/tests/integration/targets/job_template/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_job_template/tasks/main.yml rename to awx_collection/tests/integration/targets/job_template/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_job_wait/tasks/main.yml b/awx_collection/tests/integration/targets/job_wait/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_job_wait/tasks/main.yml rename to awx_collection/tests/integration/targets/job_wait/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_label/tasks/main.yml b/awx_collection/tests/integration/targets/label/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_label/tasks/main.yml rename to awx_collection/tests/integration/targets/label/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_lookup_api_plugin/tasks/main.yml b/awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_lookup_api_plugin/tasks/main.yml rename to awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_notification_template/tasks/main.yml b/awx_collection/tests/integration/targets/notification_template/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_notification_template/tasks/main.yml rename to awx_collection/tests/integration/targets/notification_template/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_organization/tasks/main.yml b/awx_collection/tests/integration/targets/organization/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_organization/tasks/main.yml rename to awx_collection/tests/integration/targets/organization/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_project/tasks/main.yml b/awx_collection/tests/integration/targets/project/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_project/tasks/main.yml rename to awx_collection/tests/integration/targets/project/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_project_manual/tasks/create_project_dir.yml b/awx_collection/tests/integration/targets/project_manual/tasks/create_project_dir.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_project_manual/tasks/create_project_dir.yml rename to awx_collection/tests/integration/targets/project_manual/tasks/create_project_dir.yml diff --git a/awx_collection/tests/integration/targets/tower_project_manual/tasks/main.yml b/awx_collection/tests/integration/targets/project_manual/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_project_manual/tasks/main.yml rename to awx_collection/tests/integration/targets/project_manual/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_project_update/tasks/main.yml b/awx_collection/tests/integration/targets/project_update/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_project_update/tasks/main.yml rename to awx_collection/tests/integration/targets/project_update/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_role/tasks/main.yml b/awx_collection/tests/integration/targets/role/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_role/tasks/main.yml rename to awx_collection/tests/integration/targets/role/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_schedule/tasks/main.yml b/awx_collection/tests/integration/targets/schedule/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_schedule/tasks/main.yml rename to awx_collection/tests/integration/targets/schedule/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_schedule_rrule/tasks/main.yml b/awx_collection/tests/integration/targets/schedule_rrule/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_schedule_rrule/tasks/main.yml rename to awx_collection/tests/integration/targets/schedule_rrule/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_settings/tasks/main.yml b/awx_collection/tests/integration/targets/settings/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_settings/tasks/main.yml rename to awx_collection/tests/integration/targets/settings/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_team/tasks/main.yml b/awx_collection/tests/integration/targets/team/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_team/tasks/main.yml rename to awx_collection/tests/integration/targets/team/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_token/tasks/main.yml b/awx_collection/tests/integration/targets/token/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_token/tasks/main.yml rename to awx_collection/tests/integration/targets/token/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_user/tasks/main.yml b/awx_collection/tests/integration/targets/user/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_user/tasks/main.yml rename to awx_collection/tests/integration/targets/user/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_workflow_job_template/tasks/main.yml b/awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_workflow_job_template/tasks/main.yml rename to awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_workflow_launch/tasks/main.yml b/awx_collection/tests/integration/targets/workflow_launch/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_workflow_launch/tasks/main.yml rename to awx_collection/tests/integration/targets/workflow_launch/tasks/main.yml diff --git a/awx_collection/tools/roles/generate/templates/tower_module.j2 b/awx_collection/tools/roles/generate/templates/module.j2 similarity index 100% rename from awx_collection/tools/roles/generate/templates/tower_module.j2 rename to awx_collection/tools/roles/generate/templates/module.j2 diff --git a/awx_collection/tools/roles/template_galaxy/tasks/main.yml b/awx_collection/tools/roles/template_galaxy/tasks/main.yml index 84f8174095..1b12854c0d 100644 --- a/awx_collection/tools/roles/template_galaxy/tasks/main.yml +++ b/awx_collection/tools/roles/template_galaxy/tasks/main.yml @@ -1,15 +1,15 @@ --- -- name: Set the collection version in the tower_api.py file +- name: Set the collection version in the controller_api.py file replace: - path: "{{ collection_path }}/plugins/module_utils/tower_api.py" + path: "{{ collection_path }}/plugins/module_utils/controller_api.py" regexp: '^ _COLLECTION_VERSION = "0.0.1-devel"' replace: ' _COLLECTION_VERSION = "{{ collection_version }}"' when: - "awx_template_version | default(True)" -- name: Set the collection type in the tower_api.py file +- name: Set the collection type in the controller_api.py file replace: - path: "{{ collection_path }}/plugins/module_utils/tower_api.py" + path: "{{ collection_path }}/plugins/module_utils/controller_api.py" regexp: '^ _COLLECTION_TYPE = "awx"' replace: ' _COLLECTION_TYPE = "{{ collection_package }}"' @@ -30,7 +30,7 @@ - name: Change inventory file to support desired namespace and package names replace: - path: "{{ collection_path }}/plugins/inventory/tower.py" + path: "{{ collection_path }}/plugins/inventory/controller.py" regexp: "^ NAME = 'awx.awx.tower' # REPLACE$" replace: " NAME = '{{ collection_namespace }}.{{ collection_package }}.tower' # REPLACE" From a695274cb61702bea28ca378f4414fa3aa5efe42 Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Wed, 28 Apr 2021 18:17:07 -0400 Subject: [PATCH 02/31] regex replace tower_*: to '' --- .../targets/ad_hoc_command/tasks/main.yml | 14 +-- .../ad_hoc_command_cancel/tasks/main.yml | 14 +-- .../ad_hoc_command_wait/tasks/main.yml | 14 +-- .../targets/application/tasks/main.yml | 10 +- .../targets/credential/tasks/main.yml | 94 +++++++++---------- .../credential_input_source/tasks/main.yml | 12 +-- .../targets/demo_data/tasks/main.yml | 10 +- .../integration/targets/export/tasks/main.yml | 14 +-- .../integration/targets/group/tasks/main.yml | 34 +++---- .../integration/targets/host/tasks/main.yml | 8 +- .../integration/targets/import/tasks/main.yml | 8 +- .../targets/instance_group/tasks/main.yml | 4 +- .../targets/inventory/tasks/main.yml | 26 ++--- .../targets/inventory_source/tasks/main.yml | 8 +- .../inventory_source_update/tasks/main.yml | 14 +-- .../targets/job_launch/tasks/main.yml | 4 +- .../targets/job_template/tasks/main.yml | 16 ++-- .../targets/job_wait/tasks/main.yml | 4 +- .../integration/targets/label/tasks/main.yml | 4 +- .../targets/lookup_api_plugin/tasks/main.yml | 16 ++-- .../targets/organization/tasks/main.yml | 18 ++-- .../targets/project/tasks/main.yml | 34 +++---- .../tasks/create_project_dir.yml | 12 +-- .../targets/project_manual/tasks/main.yml | 4 +- .../targets/project_update/tasks/main.yml | 4 +- .../integration/targets/role/tasks/main.yml | 18 ++-- .../targets/schedule/tasks/main.yml | 12 +-- .../targets/schedule_rrule/tasks/main.yml | 2 +- .../targets/settings/tasks/main.yml | 16 ++-- .../integration/targets/team/tasks/main.yml | 8 +- .../integration/targets/token/tasks/main.yml | 16 ++-- .../integration/targets/user/tasks/main.yml | 18 ++-- .../workflow_job_template/tasks/main.yml | 12 +-- 33 files changed, 251 insertions(+), 251 deletions(-) diff --git a/awx_collection/tests/integration/targets/ad_hoc_command/tasks/main.yml b/awx_collection/tests/integration/targets/ad_hoc_command/tasks/main.yml index 8dafa2338d..280bd42a79 100644 --- a/awx_collection/tests/integration/targets/ad_hoc_command/tasks/main.yml +++ b/awx_collection/tests/integration/targets/ad_hoc_command/tasks/main.yml @@ -11,24 +11,24 @@ org_name: "AWX-Collection-tests-tower_tower_ad_hoc_command-org-{{ test_id }}" - name: Create a New Organization - tower_organization: + organization: name: "{{ org_name }}" - name: Create an Inventory - tower_inventory: + inventory: name: "{{ inv_name }}" organization: "{{ org_name }}" state: present - name: Add localhost to the Inventory - tower_host: + host: name: localhost inventory: "{{ inv_name }}" variables: ansible_connection: local - name: Create a Credential - tower_credential: + credential: name: "{{ ssh_cred_name }}" organization: "{{ org_name }}" credential_type: 'Machine' @@ -76,19 +76,19 @@ - "'Does not exist' in result.response['json']['module_name'][0]" - name: Delete the Credential - tower_credential: + credential: name: "{{ ssh_cred_name }}" organization: "{{ org_name }}" credential_type: 'Machine' state: absent - name: Delete the Inventory - tower_inventory: + inventory: name: "{{ inv_name }}" organization: "{{ org_name }}" state: absent - name: Remove the Organization - tower_organization: + organization: name: "{{ org_name }}" state: absent diff --git a/awx_collection/tests/integration/targets/ad_hoc_command_cancel/tasks/main.yml b/awx_collection/tests/integration/targets/ad_hoc_command_cancel/tasks/main.yml index 46aaa0edd6..eab310b1ab 100644 --- a/awx_collection/tests/integration/targets/ad_hoc_command_cancel/tasks/main.yml +++ b/awx_collection/tests/integration/targets/ad_hoc_command_cancel/tasks/main.yml @@ -11,24 +11,24 @@ org_name: "AWX-Collection-tests-tower_tower_ad_hoc_command_cancel-org-{{ test_id }}" - name: Create a New Organization - tower_organization: + organization: name: "{{ org_name }}" - name: Create an Inventory - tower_inventory: + inventory: name: "{{ inv_name }}" organization: "{{ org_name }}" state: present - name: Add localhost to the Inventory - tower_host: + host: name: localhost inventory: "{{ inv_name }}" variables: ansible_connection: local - name: Create a Credential - tower_credential: + credential: name: "{{ ssh_cred_name }}" organization: "{{ org_name }}" credential_type: 'Machine' @@ -91,19 +91,19 @@ - "result.msg == 'Unable to find command with id 9999999999'" - name: Delete the Credential - tower_credential: + credential: name: "{{ ssh_cred_name }}" organization: "{{ org_name }}" credential_type: 'Machine' state: absent - name: Delete the Inventory - tower_inventory: + inventory: name: "{{ inv_name }}" organization: "{{ org_name }}" state: absent - name: Remove the Organization - tower_organization: + organization: name: "{{ org_name }}" state: absent diff --git a/awx_collection/tests/integration/targets/ad_hoc_command_wait/tasks/main.yml b/awx_collection/tests/integration/targets/ad_hoc_command_wait/tasks/main.yml index 2f30de529d..fbd539330a 100644 --- a/awx_collection/tests/integration/targets/ad_hoc_command_wait/tasks/main.yml +++ b/awx_collection/tests/integration/targets/ad_hoc_command_wait/tasks/main.yml @@ -11,24 +11,24 @@ org_name: "AWX-Collection-tests-tower_ad_hoc_command_wait-org-{{ test_id }}" - name: Create a New Organization - tower_organization: + organization: name: "{{ org_name }}" - name: Create an Inventory - tower_inventory: + inventory: name: "{{ inv_name }}" organization: "{{ org_name }}" state: present - name: Add localhost to the Inventory - tower_host: + host: name: localhost inventory: "{{ inv_name }}" variables: ansible_connection: local - name: Create a Credential - tower_credential: + credential: name: "{{ ssh_cred_name }}" organization: "{{ org_name }}" credential_type: 'Machine' @@ -113,19 +113,19 @@ - "wait_results.msg == 'The ad hoc command - {{ command.id }}, failed'" - name: Delete the Credential - tower_credential: + credential: name: "{{ ssh_cred_name }}" organization: "{{ org_name }}" credential_type: 'Machine' state: absent - name: Delete the Inventory - tower_inventory: + inventory: name: "{{ inv_name }}" organization: "{{ org_name }}" state: absent - name: Remove the Organization - tower_organization: + organization: name: "{{ org_name }}" state: absent diff --git a/awx_collection/tests/integration/targets/application/tasks/main.yml b/awx_collection/tests/integration/targets/application/tasks/main.yml index cde2440075..fadc044cee 100644 --- a/awx_collection/tests/integration/targets/application/tasks/main.yml +++ b/awx_collection/tests/integration/targets/application/tasks/main.yml @@ -11,7 +11,7 @@ - block: - name: Create an application - tower_application: + application: name: "{{ app1_name }}" authorization_grant_type: "password" client_type: "public" @@ -24,7 +24,7 @@ - "result is changed" - name: Delete our application - tower_application: + application: name: "{{ app1_name }}" organization: "Default" state: absent @@ -35,7 +35,7 @@ - "result is changed" - name: Create a second application - tower_application: + application: name: "{{ app2_name }}" authorization_grant_type: "authorization-code" client_type: "confidential" @@ -52,7 +52,7 @@ - "result is changed" - name: Create an all trusting application - tower_application: + application: name: "{{ app3_name }}" organization: "Default" description: "All Trusting Application" @@ -68,7 +68,7 @@ always: - name: Delete our application - tower_application: + application: name: "{{ item }}" organization: "Default" state: absent diff --git a/awx_collection/tests/integration/targets/credential/tasks/main.yml b/awx_collection/tests/integration/targets/credential/tasks/main.yml index 4adc162778..4b5328330a 100644 --- a/awx_collection/tests/integration/targets/credential/tasks/main.yml +++ b/awx_collection/tests/integration/targets/credential/tasks/main.yml @@ -36,7 +36,7 @@ ssh_key_data: "{{ lookup('file', tempdir.stdout + '/id_rsa') }}" - name: Test deprecation warnings - tower_credential: + credential: name: "{{ ssh_cred_name1 }}" organization: Default kind: ssh @@ -70,7 +70,7 @@ - result['deprecations'] | length() == 20 - name: Create an Org-specific credential (old school) - tower_credential: + credential: name: "{{ ssh_cred_name1 }}" organization: Default state: present @@ -82,7 +82,7 @@ - "result is changed" - name: Re-create the Org-specific credential (new school) with an ID - tower_credential: + credential: name: "{{ result.id }}" organization: Default credential_type: 'Machine' @@ -94,7 +94,7 @@ - "result is not changed" - name: Delete a Org-specific credential - tower_credential: + credential: name: "{{ ssh_cred_name1 }}" organization: Default state: absent @@ -106,7 +106,7 @@ - "result is changed" - name: Create the User-specific credential - tower_credential: + credential: name: "{{ ssh_cred_name1 }}" user: admin credential_type: 'Machine' @@ -118,7 +118,7 @@ - "result is changed" - name: Delete a User-specific credential - tower_credential: + credential: name: "{{ ssh_cred_name1 }}" user: admin state: absent @@ -130,7 +130,7 @@ - "result is changed" - name: Create a valid SSH credential (old school) - tower_credential: + credential: name: "{{ ssh_cred_name2 }}" organization: Default state: present @@ -150,7 +150,7 @@ - "result is changed" - name: Create a valid SSH credential (new school) - tower_credential: + credential: name: "{{ ssh_cred_name2 }}" organization: Default state: present @@ -173,7 +173,7 @@ - result is changed - name: Create a valid SSH credential (new school) - tower_credential: + credential: name: "{{ ssh_cred_name2 }}" organization: Default state: present @@ -191,7 +191,7 @@ - result is changed - name: Check for inputs idempotency (when "inputs" is blank) - tower_credential: + credential: name: "{{ ssh_cred_name2 }}" organization: Default state: present @@ -204,7 +204,7 @@ - result is not changed - name: Copy ssh Credential - tower_credential: + credential: name: "copy_{{ ssh_cred_name2 }}" copy_from: "{{ ssh_cred_name2 }}" credential_type: Machine @@ -215,7 +215,7 @@ - result.copied - name: Delete an SSH credential - tower_credential: + credential: name: "copy_{{ ssh_cred_name2 }}" organization: Default state: absent @@ -227,7 +227,7 @@ - "result is changed" - name: Create a valid SSH credential from lookup source (old school) - tower_credential: + credential: name: "{{ ssh_cred_name3 }}" organization: Default state: present @@ -247,7 +247,7 @@ - "result is changed" - name: Create a valid SSH credential from lookup source (new school) - tower_credential: + credential: name: "{{ ssh_cred_name3 }}" organization: Default state: present @@ -269,7 +269,7 @@ - result is changed - name: Fail to create an SSH credential from a file source (old school format) - tower_credential: + credential: name: "{{ ssh_cred_name4 }}" organization: Default state: present @@ -292,7 +292,7 @@ - "'Invalid certificate or key' in result.msg" - name: Create an invalid SSH credential (passphrase required) - tower_credential: + credential: name: SSH Credential organization: Default state: present @@ -308,7 +308,7 @@ - "'must be set when SSH key is encrypted' in result.msg" - name: Create an invalid SSH credential (Organization not found) - tower_credential: + credential: name: SSH Credential organization: Missing_Organization state: present @@ -325,7 +325,7 @@ - "result.total_results == 0" - name: Delete an SSH credential - tower_credential: + credential: name: "{{ ssh_cred_name2 }}" organization: Default state: absent @@ -337,7 +337,7 @@ - "result is changed" - name: Delete an SSH credential - tower_credential: + credential: name: "{{ ssh_cred_name3 }}" organization: Default state: absent @@ -349,7 +349,7 @@ - "result is changed" - name: Delete an SSH credential - tower_credential: + credential: name: "{{ ssh_cred_name4 }}" organization: Default state: absent @@ -362,7 +362,7 @@ - "result is not changed" - name: Create a valid Vault credential - tower_credential: + credential: name: "{{ vault_cred_name1 }}" organization: Default state: present @@ -376,7 +376,7 @@ - "result is changed" - name: Delete a Vault credential - tower_credential: + credential: name: "{{ vault_cred_name1 }}" organization: Default state: absent @@ -388,7 +388,7 @@ - "result is changed" - name: Delete a Vault credential - tower_credential: + credential: name: "{{ vault_cred_name2 }}" organization: Default state: absent @@ -401,7 +401,7 @@ - "result is not changed" - name: Create a valid Network credential - tower_credential: + credential: name: "{{ net_cred_name1 }}" organization: Default state: present @@ -417,7 +417,7 @@ - "result is changed" - name: Delete a Network credential - tower_credential: + credential: name: "{{ net_cred_name1 }}" organization: Default state: absent @@ -429,7 +429,7 @@ - "result is changed" - name: Create a valid SCM credential - tower_credential: + credential: name: "{{ scm_cred_name1 }}" organization: Default state: present @@ -445,7 +445,7 @@ - "result is changed" - name: Delete an SCM credential - tower_credential: + credential: name: "{{ scm_cred_name1 }}" organization: Default state: absent @@ -457,7 +457,7 @@ - "result is changed" - name: Create a valid AWS credential - tower_credential: + credential: name: "{{ aws_cred_name1 }}" organization: Default state: present @@ -472,7 +472,7 @@ - "result is changed" - name: Delete an AWS credential - tower_credential: + credential: name: "{{ aws_cred_name1 }}" organization: Default state: absent @@ -484,7 +484,7 @@ - "result is changed" - name: Create a valid VMWare credential - tower_credential: + credential: name: "{{ vmware_cred_name1 }}" organization: Default state: present @@ -499,7 +499,7 @@ - "result is changed" - name: Delete an VMWare credential - tower_credential: + credential: name: "{{ vmware_cred_name1 }}" organization: Default state: absent @@ -511,7 +511,7 @@ - "result is changed" - name: Create a valid Satellite6 credential - tower_credential: + credential: name: "{{ sat6_cred_name1 }}" organization: Default state: present @@ -526,7 +526,7 @@ - "result is changed" - name: Delete a Satellite6 credential - tower_credential: + credential: name: "{{ sat6_cred_name1 }}" organization: Default state: absent @@ -538,7 +538,7 @@ - "result is changed" - name: Create a valid GCE credential - tower_credential: + credential: name: "{{ gce_cred_name1 }}" organization: Default state: present @@ -553,7 +553,7 @@ - "result is changed" - name: Delete a GCE credential - tower_credential: + credential: name: "{{ gce_cred_name1 }}" organization: Default state: absent @@ -565,7 +565,7 @@ - "result is changed" - name: Create a valid AzureRM credential - tower_credential: + credential: name: "{{ azurerm_cred_name1 }}" organization: Default state: present @@ -580,7 +580,7 @@ - "result is changed" - name: Create a valid AzureRM credential with a tenant - tower_credential: + credential: name: "{{ azurerm_cred_name1 }}" organization: Default state: present @@ -596,7 +596,7 @@ - "result is changed" - name: Delete an AzureRM credential - tower_credential: + credential: name: "{{ azurerm_cred_name1 }}" organization: Default state: absent @@ -608,7 +608,7 @@ - "result is changed" - name: Create a valid OpenStack credential - tower_credential: + credential: name: "{{ openstack_cred_name1 }}" organization: Default state: present @@ -625,7 +625,7 @@ - "result is changed" - name: Delete a OpenStack credential - tower_credential: + credential: name: "{{ openstack_cred_name1 }}" organization: Default state: absent @@ -637,7 +637,7 @@ - "result is changed" - name: Create a valid RHV credential - tower_credential: + credential: name: "{{ rhv_cred_name1 }}" organization: Default state: present @@ -652,7 +652,7 @@ - "result is changed" - name: Delete an RHV credential - tower_credential: + credential: name: "{{ rhv_cred_name1 }}" organization: Default state: absent @@ -664,7 +664,7 @@ - "result is changed" - name: Create a valid Insights credential - tower_credential: + credential: name: "{{ insights_cred_name1 }}" organization: Default state: present @@ -678,7 +678,7 @@ - "result is changed" - name: Delete an Insights credential - tower_credential: + credential: name: "{{ insights_cred_name1 }}" organization: Default state: absent @@ -690,7 +690,7 @@ - "result is changed" - name: Create a valid Tower-to-Tower credential - tower_credential: + credential: name: "{{ tower_cred_name1 }}" organization: Default state: present @@ -705,7 +705,7 @@ - "result is changed" - name: Delete a Tower-to-Tower credential - tower_credential: + credential: name: "{{ tower_cred_name1 }}" organization: Default state: absent @@ -717,7 +717,7 @@ - "result is changed" - name: Check module fails with correct msg - tower_credential: + credential: name: test-credential description: Credential Description kind: ssh diff --git a/awx_collection/tests/integration/targets/credential_input_source/tasks/main.yml b/awx_collection/tests/integration/targets/credential_input_source/tasks/main.yml index 608c524aaf..382b105a5c 100644 --- a/awx_collection/tests/integration/targets/credential_input_source/tasks/main.yml +++ b/awx_collection/tests/integration/targets/credential_input_source/tasks/main.yml @@ -11,7 +11,7 @@ - block: - name: Add Tower credential Lookup - tower_credential: + credential: description: Credential for Testing Source name: "{{ src_cred_name }}" credential_type: CyberArk AIM Central Credential Provider Lookup @@ -26,7 +26,7 @@ - "src_cred_result is changed" - name: Add Tower credential Target - tower_credential: + credential: description: Credential for Testing Target name: "{{ target_cred_name }}" credential_type: Machine @@ -55,7 +55,7 @@ - "result is changed" - name: Add Second Tower credential Lookup - tower_credential: + credential: description: Credential for Testing Source Change name: "{{ src_cred_name }}-2" credential_type: CyberArk AIM Central Credential Provider Lookup @@ -89,7 +89,7 @@ - "result is changed" - name: Remove Tower credential Lookup - tower_credential: + credential: name: "{{ src_cred_name }}" organization: Default credential_type: CyberArk AIM Central Credential Provider Lookup @@ -97,7 +97,7 @@ register: result - name: Remove Alt Tower credential Lookup - tower_credential: + credential: name: "{{ src_cred_name }}-2" organization: Default credential_type: CyberArk AIM Central Credential Provider Lookup @@ -105,7 +105,7 @@ register: result - name: Remove Tower credential - tower_credential: + credential: name: "{{ target_cred_name }}" organization: Default credential_type: Machine diff --git a/awx_collection/tests/integration/targets/demo_data/tasks/main.yml b/awx_collection/tests/integration/targets/demo_data/tasks/main.yml index 6006dd6669..06ac9a971f 100644 --- a/awx_collection/tests/integration/targets/demo_data/tasks/main.yml +++ b/awx_collection/tests/integration/targets/demo_data/tasks/main.yml @@ -1,10 +1,10 @@ --- - name: Assure that default organization exists - tower_organization: + organization: name: Default - name: HACK - delete orphaned projects from preload data where organization deletd - tower_project: + project: name: "{{ item['id'] }}" scm_type: git state: absent @@ -16,7 +16,7 @@ label: "Deleting Demo Project with null organization id={{ item['id'] }}" - name: Assure that demo project exists - tower_project: + project: name: "Demo Project" scm_type: 'git' scm_url: 'https://github.com/ansible/ansible-tower-samples' @@ -24,12 +24,12 @@ organization: Default - name: Assure that demo inventory exists - tower_inventory: + inventory: name: "Demo Inventory" organization: Default - name: Create a Host - tower_host: + host: name: "localhost" inventory: "Demo Inventory" state: present diff --git a/awx_collection/tests/integration/targets/export/tasks/main.yml b/awx_collection/tests/integration/targets/export/tasks/main.yml index 7ffbc15820..be06a0976a 100644 --- a/awx_collection/tests/integration/targets/export/tasks/main.yml +++ b/awx_collection/tests/integration/targets/export/tasks/main.yml @@ -12,19 +12,19 @@ - block: - name: Create some organizations - tower_organization: + organization: name: "{{ item }}" loop: - "{{ org_name1 }}" - "{{ org_name2 }}" - name: Create an inventory - tower_inventory: + inventory: name: "{{ inventory_name1 }}" organization: "{{ org_name1 }}" - name: Export all tower assets - tower_export: + export: all: true register: all_assets @@ -35,7 +35,7 @@ - all_assets['assets']['organizations'] | length() >= 2 - name: Export all inventories - tower_export: + export: inventory: 'all' register: inventory_export @@ -48,7 +48,7 @@ # This mimics the example in the module - name: Export an all and a specific - tower_export: + export: inventory: 'all' organizations: "{{ org_name1 }}" register: mixed_export @@ -63,13 +63,13 @@ always: - name: Remove our inventory - tower_inventory: + inventory: name: "{{ inventory_name1 }}" organization: "{{ org_name1 }}" state: absent - name: Remove test organizations - tower_organization: + organization: name: "{{ item }}" state: absent loop: diff --git a/awx_collection/tests/integration/targets/group/tasks/main.yml b/awx_collection/tests/integration/targets/group/tasks/main.yml index 5184e94d5b..2fc4e4a42b 100644 --- a/awx_collection/tests/integration/targets/group/tasks/main.yml +++ b/awx_collection/tests/integration/targets/group/tasks/main.yml @@ -10,14 +10,14 @@ host_name3: "AWX-Collection-test-tower_group-host-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - name: Create an Inventory - tower_inventory: + inventory: name: "{{ inv_name }}" organization: Default state: present register: result - name: Create a Group - tower_group: + group: name: "{{ group_name1 }}" inventory: "{{ result.id }}" state: present @@ -30,7 +30,7 @@ - "result is changed" - name: Create a Group - tower_group: + group: name: "{{ group_name2 }}" inventory: "{{ inv_name }}" state: present @@ -43,7 +43,7 @@ - "result is changed" - name: Create a Group - tower_group: + group: name: "{{ group_name3 }}" inventory: "{{ inv_name }}" state: present @@ -56,7 +56,7 @@ - "result is changed" - name: add hosts - tower_host: + host: name: "{{ item }}" inventory: "{{ inv_name }}" loop: @@ -65,7 +65,7 @@ - "{{ host_name3 }}" - name: Create a Group with hosts and sub group - tower_group: + group: name: "{{ group_name1 }}" inventory: "{{ inv_name }}" hosts: @@ -79,7 +79,7 @@ register: result - name: Create a Group with hosts and sub group - tower_group: + group: name: "{{ group_name1 }}" inventory: "{{ inv_name }}" hosts: @@ -100,7 +100,7 @@ - group1_host_count == "3" - name: Delete a Group - tower_group: + group: name: "{{ group_name1 }}" inventory: "{{ inv_name }}" state: absent @@ -111,7 +111,7 @@ - "result is changed" - name: Delete a Group - tower_group: + group: name: "{{ group_name2 }}" inventory: "{{ inv_name }}" state: absent @@ -122,7 +122,7 @@ - "result is changed" - name: Delete a Group - tower_group: + group: name: "{{ group_name3 }}" inventory: "{{ inv_name }}" state: absent @@ -133,7 +133,7 @@ - "result is not changed" - name: Check module fails with correct msg - tower_group: + group: name: test-group description: Group Description inventory: test-non-existing-inventory @@ -149,7 +149,7 @@ - "result.total_results == 0" - name: add hosts - tower_host: + host: name: "{{ item }}" inventory: "{{ inv_name }}" loop: @@ -158,14 +158,14 @@ - "{{ host_name3 }}" - name: add mid level group - tower_group: + group: name: "{{ group_name2 }}" inventory: "{{ inv_name }}" hosts: - "{{ host_name3 }}" - name: add top group - tower_group: + group: name: "{{ group_name3 }}" inventory: "{{ inv_name }}" hosts: @@ -175,19 +175,19 @@ - "{{ group_name2 }}" - name: Delete the parent group - tower_group: + group: name: "{{ group_name3 }}" inventory: "{{ inv_name }}" state: absent - name: Delete the child group - tower_group: + group: name: "{{ group_name2 }}" inventory: "{{ inv_name }}" state: absent - name: Delete an Inventory - tower_inventory: + inventory: name: "{{ inv_name }}" organization: Default state: absent diff --git a/awx_collection/tests/integration/targets/host/tasks/main.yml b/awx_collection/tests/integration/targets/host/tasks/main.yml index 4135815553..185412c180 100644 --- a/awx_collection/tests/integration/targets/host/tasks/main.yml +++ b/awx_collection/tests/integration/targets/host/tasks/main.yml @@ -5,14 +5,14 @@ inv_name: "AWX-Collection-tests-tower_host-inv-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - name: Create an Inventory - tower_inventory: + inventory: name: "{{ inv_name }}" organization: Default state: present register: result - name: Create a Host - tower_host: + host: name: "{{ host_name }}" inventory: "{{ result.id }}" state: present @@ -25,7 +25,7 @@ - "result is changed" - name: Delete a Host - tower_host: + host: name: "{{ result.id }}" inventory: "{{ inv_name }}" state: absent @@ -36,7 +36,7 @@ - "result is changed" - name: Check module fails with correct msg - tower_host: + host: name: test-host description: Host Description inventory: test-non-existing-inventory diff --git a/awx_collection/tests/integration/targets/import/tasks/main.yml b/awx_collection/tests/integration/targets/import/tasks/main.yml index 5c04958ac7..818fe4ee3c 100644 --- a/awx_collection/tests/integration/targets/import/tasks/main.yml +++ b/awx_collection/tests/integration/targets/import/tasks/main.yml @@ -11,7 +11,7 @@ - block: - name: "Import something" - tower_import: + import: assets: organizations: - name: "{{ org_name1 }}" @@ -33,7 +33,7 @@ - import_output is changed - name: "Import the same thing again" - tower_import: + import: assets: organizations: - name: "{{ org_name1 }}" @@ -82,7 +82,7 @@ dest: ./org.json - name: "Load assets from a file" - tower_import: + import: assets: "{{ lookup('file', 'org.json') | from_json() }}" register: import_output @@ -92,7 +92,7 @@ always: - name: Remove organizations - tower_organization: + organization: name: "{{ item }}" state: absent loop: diff --git a/awx_collection/tests/integration/targets/instance_group/tasks/main.yml b/awx_collection/tests/integration/targets/instance_group/tasks/main.yml index 8389c13782..b763f5636a 100644 --- a/awx_collection/tests/integration/targets/instance_group/tasks/main.yml +++ b/awx_collection/tests/integration/targets/instance_group/tasks/main.yml @@ -11,7 +11,7 @@ - block: - name: Create an OpenShift Credential - tower_credential: + credential: name: "{{ cred_name1 }}" organization: "Default" credential_type: "OpenShift or Kubernetes API Bearer Token" @@ -70,7 +70,7 @@ - "{{ group_name2 }}" - name: Delete the credential - tower_credential: + credential: name: "{{ cred_name1 }}" organization: "Default" credential_type: "OpenShift or Kubernetes API Bearer Token" diff --git a/awx_collection/tests/integration/targets/inventory/tasks/main.yml b/awx_collection/tests/integration/targets/inventory/tasks/main.yml index 7906a79205..6d2f27094d 100644 --- a/awx_collection/tests/integration/targets/inventory/tasks/main.yml +++ b/awx_collection/tests/integration/targets/inventory/tasks/main.yml @@ -23,7 +23,7 @@ - "result is changed" - name: Create an Insights Credential - tower_credential: + credential: name: "{{ cred_name1 }}" organization: Default kind: insights @@ -38,7 +38,7 @@ - "result is changed" - name: Create an Inventory - tower_inventory: + inventory: name: "{{ inv_name1 }}" organization: Default insights_credential: "{{ result.id }}" @@ -52,7 +52,7 @@ - "result is changed" - name: Test Inventory module idempotency - tower_inventory: + inventory: name: "{{ result.id }}" organization: Default insights_credential: "{{ cred_name1 }}" @@ -64,7 +64,7 @@ - "result is not changed" - name: Copy an inventory - tower_inventory: + inventory: name: "copy_{{ inv_name1 }}" copy_from: "{{ inv_name1 }}" organization: Default @@ -77,7 +77,7 @@ - result.copied - name: Delete an Inventory - tower_inventory: + inventory: name: "copy_{{ inv_name1 }}" organization: Default state: absent @@ -88,7 +88,7 @@ - "result is changed" - name: Fail Change Regular to Smart - tower_inventory: + inventory: name: "{{ inv_name1 }}" organization: Default kind: smart @@ -100,7 +100,7 @@ - "result is failed" - name: Create a smart inventory - tower_inventory: + inventory: name: "{{ inv_name2 }}" organization: Default kind: smart @@ -112,7 +112,7 @@ - "result is changed" - name: Delete a smart inventory - tower_inventory: + inventory: name: "{{ inv_name2 }}" organization: Default kind: smart @@ -125,7 +125,7 @@ - "result is changed" - name: Delete an Inventory - tower_inventory: + inventory: name: "{{ inv_name1 }}" organization: Default state: absent @@ -136,7 +136,7 @@ - "result is changed" - name: Delete a Non-Existent Inventory - tower_inventory: + inventory: name: "{{ inv_name1 }}" organization: Default state: absent @@ -147,7 +147,7 @@ - "result is not changed" - name: Check module fails with correct msg - tower_inventory: + inventory: name: test-inventory description: Inventory Description organization: test-non-existing-org @@ -164,7 +164,7 @@ always: - name: Delete Inventories - tower_inventory: + inventory: name: "{{ item }}" organization: Default state: absent @@ -179,7 +179,7 @@ state: absent - name: Delete Insights Credential - tower_credential: + credential: name: "{{ cred_name1 }}" organization: "Default" kind: insights diff --git a/awx_collection/tests/integration/targets/inventory_source/tasks/main.yml b/awx_collection/tests/integration/targets/inventory_source/tasks/main.yml index 1c9bd99506..7878e8fa22 100644 --- a/awx_collection/tests/integration/targets/inventory_source/tasks/main.yml +++ b/awx_collection/tests/integration/targets/inventory_source/tasks/main.yml @@ -6,7 +6,7 @@ openstack_inv_source: "AWX-Collection-tests-tower_inventory_source-inv-source-openstack-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - name: Add a Tower credential - tower_credential: + credential: description: Credentials for Openstack Test project name: "{{ openstack_cred }}" kind: openstack @@ -19,7 +19,7 @@ register: credential_result - name: Add a Tower inventory - tower_inventory: + inventory: description: Test inventory organization: Default name: "{{ openstack_inv }}" @@ -54,7 +54,7 @@ - "result is changed" - name: Delete the credential - tower_credential: + credential: description: Credentials for Openstack Test project name: "{{ openstack_cred }}" kind: openstack @@ -71,7 +71,7 @@ - "result is changed" - name: Delete the inventory - tower_inventory: + inventory: description: Test inventory organization: Default name: "{{ openstack_inv }}" diff --git a/awx_collection/tests/integration/targets/inventory_source_update/tasks/main.yml b/awx_collection/tests/integration/targets/inventory_source_update/tasks/main.yml index 414e052fe6..a8a78f7a87 100644 --- a/awx_collection/tests/integration/targets/inventory_source_update/tasks/main.yml +++ b/awx_collection/tests/integration/targets/inventory_source_update/tasks/main.yml @@ -16,12 +16,12 @@ - block: - name: "Create a new organization" - tower_organization: + organization: name: "{{ org_name }}" register: created_org - name: Create a git project without credentials - tower_project: + project: name: "{{ project_name }}" organization: "{{ org_name }}" scm_type: git @@ -29,13 +29,13 @@ wait: true - name: Create an Inventory - tower_inventory: + inventory: name: "{{ inv_name }}" organization: "{{ org_name }}" state: present - name: Create another inventory w/ same name, different org - tower_inventory: + inventory: name: "{{ inv_name }}" organization: Default state: present @@ -114,18 +114,18 @@ always: - name: Delete Inventory - tower_inventory: + inventory: name: "{{ inv_name }}" organization: Default state: absent - name: Delete Project - tower_project: + project: name: "{{ project_name }}" organization: Default state: absent - name: "Remove the organization" - tower_organization: + organization: name: "{{ org_name }}" state: absent diff --git a/awx_collection/tests/integration/targets/job_launch/tasks/main.yml b/awx_collection/tests/integration/targets/job_launch/tasks/main.yml index 30fa8cc13b..6828fbc93e 100644 --- a/awx_collection/tests/integration/targets/job_launch/tasks/main.yml +++ b/awx_collection/tests/integration/targets/job_launch/tasks/main.yml @@ -70,7 +70,7 @@ - "result.status == 'pending'" - name: Create a project for testing extra_vars - tower_project: + project: name: "{{ proj_name }}" organization: Default scm_type: git @@ -216,7 +216,7 @@ - "result is changed" - name: Delete the extra_vars project - tower_project: + project: name: "{{ proj_name }}" organization: Default state: absent diff --git a/awx_collection/tests/integration/targets/job_template/tasks/main.yml b/awx_collection/tests/integration/targets/job_template/tasks/main.yml index 6ad195732b..b32af29e92 100644 --- a/awx_collection/tests/integration/targets/job_template/tasks/main.yml +++ b/awx_collection/tests/integration/targets/job_template/tasks/main.yml @@ -25,7 +25,7 @@ register: result - name: Create a Demo Project - tower_project: + project: name: "{{ proj1 }}" organization: Default state: present @@ -34,20 +34,20 @@ register: proj_result - name: Create Credential1 - tower_credential: + credential: name: "{{ cred1 }}" organization: Default kind: tower register: cred1_result - name: Create Credential2 - tower_credential: + credential: name: "{{ cred2 }}" organization: Default kind: ssh - name: Create Credential3 - tower_credential: + credential: name: "{{ cred3 }}" organization: Default kind: ssh @@ -374,7 +374,7 @@ - "result is changed" - name: Delete the Demo Project - tower_project: + project: name: "{{ proj1 }}" organization: Default state: absent @@ -383,21 +383,21 @@ register: result - name: Delete Credential1 - tower_credential: + credential: name: "{{ cred1 }}" organization: Default kind: tower state: absent - name: Delete Credential2 - tower_credential: + credential: name: "{{ cred2 }}" organization: Default kind: ssh state: absent - name: Delete Credential3 - tower_credential: + credential: name: "{{ cred3 }}" organization: Default kind: ssh diff --git a/awx_collection/tests/integration/targets/job_wait/tasks/main.yml b/awx_collection/tests/integration/targets/job_wait/tasks/main.yml index 2b3b8e4536..d21e75b8e6 100644 --- a/awx_collection/tests/integration/targets/job_wait/tasks/main.yml +++ b/awx_collection/tests/integration/targets/job_wait/tasks/main.yml @@ -5,7 +5,7 @@ proj_name: "AWX-Collection-tests-tower_job_wait-long_running-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - name: Assure that the demo project exists - tower_project: + project: name: "{{ proj_name }}" scm_type: 'git' scm_url: 'https://github.com/ansible/test-playbooks.git' @@ -131,7 +131,7 @@ state: absent - name: Delete the project - tower_project: + project: name: "{{ proj_name }}" organization: Default state: absent diff --git a/awx_collection/tests/integration/targets/label/tasks/main.yml b/awx_collection/tests/integration/targets/label/tasks/main.yml index 814d2cd56a..fbb4c3e00f 100644 --- a/awx_collection/tests/integration/targets/label/tasks/main.yml +++ b/awx_collection/tests/integration/targets/label/tasks/main.yml @@ -4,13 +4,13 @@ label_name: "AWX-Collection-tests-tower_label-label-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - name: Create a Label - tower_label: + label: name: "{{ label_name }}" organization: Default state: present - name: Check module fails with correct msg - tower_label: + label: name: "Test Label" organization: "Non_existing_org" state: present diff --git a/awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml b/awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml index 9f5d42ac20..7c4ea04799 100644 --- a/awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml +++ b/awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml @@ -16,7 +16,7 @@ group_name: "AWX-Collection-tests-tower_api_lookup-group1-{{ test_id }}" - name: Get our collection package - tower_meta: + meta: register: tower_meta - name: Generate the name of our plugin @@ -24,7 +24,7 @@ plugin_name: "{{ tower_meta.prefix }}.tower_api" - name: Create all of our users - tower_user: + user: username: "{{ item }}" is_superuser: true password: "{{ test_id }}" @@ -43,7 +43,7 @@ - "'DNE' in results.msg" - name: Create our hosts - tower_host: + host: name: "{{ item }}" inventory: "Demo Inventory" loop: "{{ hosts }}" @@ -200,7 +200,7 @@ label: "{{ item['name'] }}" - name: Make sure user 'john' is an org admin of the default org if the user exists - tower_role: + role: organization: Default role: admin user: "{{ usernames[0] }}" @@ -213,7 +213,7 @@ - tower_role_revoke is skipped - name: Create an inventory group with all 'foo' hosts - tower_group: + group: name: "{{ group_name }}" inventory: "Demo Inventory" hosts: >- @@ -229,20 +229,20 @@ always: - name: Cleanup group - tower_group: + group: name: "{{ group_name }}" inventory: "Demo Inventory" state: absent - name: Cleanup hosts - tower_host: + host: name: "{{ item }}" inventory: "Demo Inventory" state: absent loop: "{{ hosts }}" - name: Cleanup users - tower_user: + user: username: "{{ item }}" state: absent loop: "{{ usernames }}" diff --git a/awx_collection/tests/integration/targets/organization/tasks/main.yml b/awx_collection/tests/integration/targets/organization/tasks/main.yml index cee92baa51..8fae9a81d8 100644 --- a/awx_collection/tests/integration/targets/organization/tasks/main.yml +++ b/awx_collection/tests/integration/targets/organization/tasks/main.yml @@ -9,13 +9,13 @@ group_name1: "AWX-Collection-tests-tower_instance_group-group1-{{ test_id }}" - name: Make sure {{ org_name }} is not there - tower_organization: + organization: name: "{{ org_name }}" state: absent register: result - name: "Create a new organization" - tower_organization: + organization: name: "{{ org_name }}" galaxy_credentials: - Ansible Galaxy @@ -25,7 +25,7 @@ that: "result is changed" - name: "Make sure making the same org is not a change" - tower_organization: + organization: name: "{{ org_name }}" register: result @@ -44,7 +44,7 @@ - "result is changed" - name: "Pass in all parameters" - tower_organization: + organization: name: "{{ org_name }}" description: "A description" instance_groups: @@ -56,7 +56,7 @@ - "result is changed" - name: "Change the description" - tower_organization: + organization: name: "{{ org_name }}" description: "A new description" register: result @@ -71,7 +71,7 @@ state: absent - name: "Remove the organization" - tower_organization: + organization: name: "{{ org_name }}" state: absent register: result @@ -81,7 +81,7 @@ - "result is changed" - name: "Remove a missing organization" - tower_organization: + organization: name: "{{ org_name }}" state: absent register: result @@ -92,7 +92,7 @@ # Test behaviour common to all tower modules - name: Check that SSL is available and verify_ssl is enabled (task must fail) - tower_organization: + organization: name: Default validate_certs: true ignore_errors: true @@ -104,6 +104,6 @@ - "'CERTIFICATE_VERIFY_FAILED' in check_ssl_is_used['msg']" - name: Check that verify_ssl is disabled (task must not fail) - tower_organization: + organization: name: Default validate_certs: false diff --git a/awx_collection/tests/integration/targets/project/tasks/main.yml b/awx_collection/tests/integration/targets/project/tasks/main.yml index b3fa53c34c..04a9e55a62 100644 --- a/awx_collection/tests/integration/targets/project/tasks/main.yml +++ b/awx_collection/tests/integration/targets/project/tasks/main.yml @@ -11,7 +11,7 @@ - block: - name: Create an SCM Credential - tower_credential: + credential: name: "{{ scm_cred_name }}" organization: Default kind: scm @@ -22,7 +22,7 @@ - result is changed - name: Create a git project without credentials and wait - tower_project: + project: name: "{{ project_name1 }}" organization: Default scm_type: git @@ -35,7 +35,7 @@ - result is changed - name: Recreate the project to validate not changed - tower_project: + project: name: "{{ project_name1 }}" organization: Default scm_type: git @@ -49,7 +49,7 @@ - result is not changed - name: Create organizations - tower_organization: + organization: name: "{{ org_name }}" register: result @@ -58,7 +58,7 @@ - result is changed - name: Create credential - tower_credential: + credential: kind: scm name: "{{ cred_name }}" organization: "{{ org_name }}" @@ -69,7 +69,7 @@ - result is changed - name: Create a new test project in check_mode - tower_project: + project: name: "{{ project_name2 }}" organization: "{{ org_name }}" scm_type: git @@ -78,7 +78,7 @@ check_mode: true - name: "Copy tower project from {{ project_name1 }}" - tower_project: + project: name: "{{ project_name2 }}" copy_from: "{{ project_name1 }}" organization: "{{ org_name }}" @@ -94,7 +94,7 @@ - result.copied - name: Check module fails with correct msg when given non-existing org as param - tower_project: + project: name: "{{ project_name2 }}" organization: Non_Existing_Org scm_type: git @@ -111,7 +111,7 @@ - "result.total_results == 0" - name: Check module fails with correct msg when given non-existing credential as param - tower_project: + project: name: "{{ project_name2 }}" organization: "{{ org_name }}" scm_type: git @@ -128,7 +128,7 @@ - "result.total_results == 0" - name: Create a git project without credentials without waiting - tower_project: + project: name: "{{ project_name3 }}" organization: Default scm_type: git @@ -142,7 +142,7 @@ - result is changed - name: Update the project and wait. Verify not changed as no change made to repo and refspec not changed - tower_project: + project: name: "{{ project_name3 }}" organization: Default scm_type: git @@ -192,19 +192,19 @@ state: absent - name: Delete the test project 3 - tower_project: + project: name: "{{ project_name3 }}" organization: Default state: absent - name: Delete the test project 2 - tower_project: + project: name: "{{ project_name2 }}" organization: "{{ org_name }}" state: absent - name: Delete the SCM Credential - tower_credential: + credential: name: "{{ scm_cred_name }}" organization: Default kind: scm @@ -216,7 +216,7 @@ - result is changed - name: Delete the test project 1 - tower_project: + project: name: "{{ project_name1 }}" organization: Default state: absent @@ -227,7 +227,7 @@ - result is changed - name: Delete credential - tower_credential: + credential: kind: scm name: "{{ cred_name }}" organization: "{{ org_name }}" @@ -239,7 +239,7 @@ - result is changed - name: Delete the organization - tower_organization: + organization: name: "{{ org_name }}" state: absent register: result diff --git a/awx_collection/tests/integration/targets/project_manual/tasks/create_project_dir.yml b/awx_collection/tests/integration/targets/project_manual/tasks/create_project_dir.yml index 807c604dd9..51beba1203 100644 --- a/awx_collection/tests/integration/targets/project_manual/tasks/create_project_dir.yml +++ b/awx_collection/tests/integration/targets/project_manual/tasks/create_project_dir.yml @@ -5,18 +5,18 @@ vars: tower_settings: "{{ lookup('awx.awx.tower_api', 'config/') }}" -- tower_inventory: +- inventory: name: localhost organization: Default -- tower_host: +- host: name: localhost inventory: localhost variables: ansible_connection: local - name: create an unused SSH / Machine credential - tower_credential: + credential: name: dummy kind: ssh ssh_key_data: | @@ -29,7 +29,7 @@ - block: - name: Add a path to a setting - tower_settings: + settings: name: AWX_ISOLATION_SHOW_PATHS value: "[{{ project_base_dir }}]" @@ -44,12 +44,12 @@ always: - name: Delete path from setting - tower_settings: + settings: name: AWX_ISOLATION_SHOW_PATHS value: [] - name: Delete dummy credential - tower_credential: + credential: name: dummy kind: ssh state: absent diff --git a/awx_collection/tests/integration/targets/project_manual/tasks/main.yml b/awx_collection/tests/integration/targets/project_manual/tasks/main.yml index 8718219efb..a0e4315680 100644 --- a/awx_collection/tests/integration/targets/project_manual/tasks/main.yml +++ b/awx_collection/tests/integration/targets/project_manual/tasks/main.yml @@ -14,7 +14,7 @@ import_tasks: create_project_dir.yml - name: Create a manual project - tower_project: + project: name: "{{ project_name }}" organization: Default scm_type: manual @@ -26,7 +26,7 @@ - "result is changed" - name: Delete a manual project - tower_project: + project: name: "{{ project_name }}" organization: Default state: absent diff --git a/awx_collection/tests/integration/targets/project_update/tasks/main.yml b/awx_collection/tests/integration/targets/project_update/tasks/main.yml index dd614d552a..2c9dc194b1 100644 --- a/awx_collection/tests/integration/targets/project_update/tasks/main.yml +++ b/awx_collection/tests/integration/targets/project_update/tasks/main.yml @@ -9,7 +9,7 @@ project_name1: "AWX-Collection-tests-tower_project_update-project-{{ test_id }}" - name: Create a git project without credentials without waiting - tower_project: + project: name: "{{ project_name1 }}" organization: Default scm_type: git @@ -56,7 +56,7 @@ - result is not changed - name: Delete the test project 1 - tower_project: + project: name: "{{ project_name1 }}" organization: Default state: absent diff --git a/awx_collection/tests/integration/targets/role/tasks/main.yml b/awx_collection/tests/integration/targets/role/tasks/main.yml index 6c62e31832..03beed9659 100644 --- a/awx_collection/tests/integration/targets/role/tasks/main.yml +++ b/awx_collection/tests/integration/targets/role/tasks/main.yml @@ -13,7 +13,7 @@ - block: - name: Create a User - tower_user: + user: first_name: Joe last_name: User username: "{{ username }}" @@ -27,7 +27,7 @@ - "result is changed" - name: Create a project - tower_project: + project: name: "{{ project_name }}" organization: Default scm_type: git @@ -55,7 +55,7 @@ - "result is changed" - name: Add Joe to the update role of the default Project with lookup Organization - tower_role: + role: user: "{{ username }}" role: update lookup_organization: Default @@ -71,7 +71,7 @@ - "result is changed" - name: Add Joe to the new project by ID - tower_role: + role: user: "{{ username }}" role: update project: "{{ project_info['id'] }}" @@ -92,7 +92,7 @@ state: present - name: Add Joe to workflow execute role - tower_role: + role: user: "{{ username }}" role: execute workflow: test-role-workflow @@ -107,7 +107,7 @@ - "result is changed" - name: Add Joe to workflow execute role, no-op - tower_role: + role: user: "{{ username }}" role: execute workflow: test-role-workflow @@ -119,7 +119,7 @@ - "result is not changed" - name: Add Joe to workflow approve role - tower_role: + role: user: "{{ username }}" role: approval workflow: test-role-workflow @@ -132,7 +132,7 @@ always: - name: Delete a User - tower_user: + user: username: "{{ username }}" email: joe@example.org state: absent @@ -151,7 +151,7 @@ register: result - name: Delete the project - tower_project: + project: name: "{{ project_name }}" organization: Default state: absent diff --git a/awx_collection/tests/integration/targets/schedule/tasks/main.yml b/awx_collection/tests/integration/targets/schedule/tasks/main.yml index 9a2caa0c93..999df2f768 100644 --- a/awx_collection/tests/integration/targets/schedule/tasks/main.yml +++ b/awx_collection/tests/integration/targets/schedule/tasks/main.yml @@ -8,7 +8,7 @@ sched1: "AWX-Collection-tests-tower_schedule-sched1-{{ test_id }}" - name: Try to create without an rrule - tower_schedule: + schedule: name: "{{ sched1 }}" state: present unified_job_template: "Demo Job Template" @@ -22,7 +22,7 @@ - "'Unable to create schedule {{ sched1 }}' in result.msg" - name: Create with options that the JT does not support - tower_schedule: + schedule: name: "{{ sched1 }}" state: present unified_job_template: "Demo Job Template" @@ -48,7 +48,7 @@ - "'Unable to create schedule {{ sched1 }}' in result.msg" - name: Build a real schedule - tower_schedule: + schedule: name: "{{ sched1 }}" state: present unified_job_template: "Demo Job Template" @@ -60,7 +60,7 @@ - result is changed - name: Rebuild the same schedule - tower_schedule: + schedule: name: "{{ sched1 }}" state: present unified_job_template: "Demo Job Template" @@ -72,7 +72,7 @@ - result is not changed - name: Disable a schedule - tower_schedule: + schedule: name: "{{ sched1 }}" state: present enabled: "false" @@ -83,6 +83,6 @@ - result is changed - name: Delete the schedule - tower_schedule: + schedule: name: "{{ sched1 }}" state: absent diff --git a/awx_collection/tests/integration/targets/schedule_rrule/tasks/main.yml b/awx_collection/tests/integration/targets/schedule_rrule/tasks/main.yml index 837821bac2..84ff069b51 100644 --- a/awx_collection/tests/integration/targets/schedule_rrule/tasks/main.yml +++ b/awx_collection/tests/integration/targets/schedule_rrule/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Get our collection package - tower_meta: + meta: register: tower_meta - name: Generate the name of our plugin diff --git a/awx_collection/tests/integration/targets/settings/tasks/main.yml b/awx_collection/tests/integration/targets/settings/tasks/main.yml index f6dcd002fd..993efad588 100644 --- a/awx_collection/tests/integration/targets/settings/tasks/main.yml +++ b/awx_collection/tests/integration/targets/settings/tasks/main.yml @@ -1,11 +1,11 @@ --- - name: Set the value of AWX_ISOLATION_SHOW_PATHS to a baseline - tower_settings: + settings: name: AWX_ISOLATION_SHOW_PATHS value: '["/var/lib/awx/projects/"]' - name: Set the value of AWX_ISOLATION_SHOW_PATHS to get an error back from Tower - tower_settings: + settings: settings: AWX_ISOLATION_SHOW_PATHS: 'not': 'a valid' @@ -18,7 +18,7 @@ - "result is failed" - name: Set the value of AWX_ISOLATION_SHOW_PATHS - tower_settings: + settings: name: AWX_ISOLATION_SHOW_PATHS value: '["/var/lib/awx/projects/", "/tmp"]' register: result @@ -28,7 +28,7 @@ - "result is changed" - name: Attempt to set the value of AWX_ISOLATION_BASE_PATH to what it already is - tower_settings: + settings: name: AWX_ISOLATION_BASE_PATH value: /tmp register: result @@ -41,7 +41,7 @@ - "result is not changed" - name: Apply a single setting via settings - tower_settings: + settings: name: AWX_ISOLATION_SHOW_PATHS value: '["/var/lib/awx/projects/", "/var/tmp"]' register: result @@ -51,7 +51,7 @@ - "result is changed" - name: Apply multiple setting via settings with no change - tower_settings: + settings: settings: AWX_ISOLATION_BASE_PATH: /tmp AWX_ISOLATION_SHOW_PATHS: ["/var/lib/awx/projects/", "/var/tmp"] @@ -65,7 +65,7 @@ - "result is not changed" - name: Apply multiple setting via settings with change - tower_settings: + settings: settings: AWX_ISOLATION_BASE_PATH: /tmp AWX_ISOLATION_SHOW_PATHS: [] @@ -76,7 +76,7 @@ - "result is changed" - name: Handle an omit value - tower_settings: + settings: name: AWX_ISOLATION_BASE_PATH value: '{{ junk_var | default(omit) }}' register: result diff --git a/awx_collection/tests/integration/targets/team/tasks/main.yml b/awx_collection/tests/integration/targets/team/tasks/main.yml index 0284caeaf1..e095d9a543 100644 --- a/awx_collection/tests/integration/targets/team/tasks/main.yml +++ b/awx_collection/tests/integration/targets/team/tasks/main.yml @@ -4,7 +4,7 @@ team_name: "AWX-Collection-tests-tower_team-team-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - name: Attempt to add a Tower team to a non-existant Organization - tower_team: + team: name: Test Team organization: Missing_Organization state: present @@ -20,7 +20,7 @@ - "result.total_results == 0" - name: Create a Tower team - tower_team: + team: name: "{{ team_name }}" organization: Default register: result @@ -30,7 +30,7 @@ - "result is changed" - name: Delete a Tower team - tower_team: + team: name: "{{ team_name }}" organization: Default state: absent @@ -41,7 +41,7 @@ - "result is changed" - name: Check module fails with correct msg - tower_team: + team: name: "{{ team_name }}" organization: Non_Existing_Org state: present diff --git a/awx_collection/tests/integration/targets/token/tasks/main.yml b/awx_collection/tests/integration/targets/token/tasks/main.yml index 0d7b099076..739ad9b2a3 100644 --- a/awx_collection/tests/integration/targets/token/tasks/main.yml +++ b/awx_collection/tests/integration/targets/token/tasks/main.yml @@ -5,7 +5,7 @@ - name: Try to use a token as a dict which is missing the token parameter tower_job_list: - tower_oauthtoken: + oauthtoken: not_token: "This has no token entry" register: results ignore_errors: true @@ -17,7 +17,7 @@ - name: Try to use a token as a list tower_job_list: - tower_oauthtoken: + oauthtoken: - dummy_token register: results ignore_errors: true @@ -28,7 +28,7 @@ - '"The provided tower_oauthtoken type was not valid (list). Valid options are str or dict." == results.msg' - name: Try to delete a token with no existing_token or existing_token_id - tower_token: + token: state: absent register: results ignore_errors: true @@ -39,7 +39,7 @@ # We don't assert a message here because it's handled by ansible - name: Try to delete a token with both existing_token or existing_token_id - tower_token: + token: existing_token: id: 1234 existing_token_id: 1234 @@ -55,7 +55,7 @@ - block: - name: Create a Token - tower_token: + token: description: '{{ token_description }}' scope: "write" state: present @@ -73,7 +73,7 @@ always: - name: Delete our Token with our own token - tower_token: + token: existing_token: "{{ tower_token }}" tower_oauthtoken: "{{ tower_token }}" state: absent @@ -86,7 +86,7 @@ - block: - name: Create a second token - tower_token: + token: description: '{{ token_description }}' scope: "write" state: present @@ -98,7 +98,7 @@ always: - name: Delete the second Token with our own token - tower_token: + token: existing_token_id: "{{ tower_token['id'] }}" tower_oauthtoken: "{{ tower_token }}" state: absent diff --git a/awx_collection/tests/integration/targets/user/tasks/main.yml b/awx_collection/tests/integration/targets/user/tasks/main.yml index 79077479df..7c17c24ac8 100644 --- a/awx_collection/tests/integration/targets/user/tasks/main.yml +++ b/awx_collection/tests/integration/targets/user/tasks/main.yml @@ -4,7 +4,7 @@ username: "AWX-Collection-tests-tower_user-user-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - name: Create a User - tower_user: + user: username: "{{ username }}" first_name: Joe password: "{{ 65535 | random | to_uuid }}" @@ -16,7 +16,7 @@ - "result is changed" - name: Change a User by ID - tower_user: + user: username: "{{ result.id }}" last_name: User email: joe@example.org @@ -28,7 +28,7 @@ - "result is changed" - name: Check idempotency - tower_user: + user: username: "{{ username }}" first_name: Joe last_name: User @@ -39,7 +39,7 @@ - "result is not changed" - name: Delete a User - tower_user: + user: username: "{{ username }}" email: joe@example.org state: absent @@ -50,7 +50,7 @@ - "result is changed" - name: Create an Auditor - tower_user: + user: first_name: Joe last_name: Auditor username: "{{ username }}" @@ -65,7 +65,7 @@ - "result is changed" - name: Delete an Auditor - tower_user: + user: username: "{{ username }}" email: joe@example.org state: absent @@ -76,7 +76,7 @@ - "result is changed" - name: Create a Superuser - tower_user: + user: first_name: Joe last_name: Super username: "{{ username }}" @@ -91,7 +91,7 @@ - "result is changed" - name: Delete a Superuser - tower_user: + user: username: "{{ username }}" email: joe@example.org state: absent @@ -102,7 +102,7 @@ - "result is changed" - name: Test tower SSL parameter - tower_user: + user: first_name: Joe last_name: User username: "{{ username }}" diff --git a/awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml b/awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml index 8741f0cb1b..5808bdbba4 100644 --- a/awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml +++ b/awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml @@ -26,7 +26,7 @@ register: result - name: Create an SCM Credential - tower_credential: + credential: name: "{{ scm_cred_name }}" organization: Default kind: scm @@ -72,7 +72,7 @@ - "{{ org_name }}" - name: Create a Demo Project - tower_project: + project: name: "{{ demo_project_name }}" organization: Default state: present @@ -86,7 +86,7 @@ - "result is changed" - name: Add a Tower inventory - tower_inventory: + inventory: description: Test inventory organization: Default name: "{{ project_inv }}" @@ -618,7 +618,7 @@ - "result is changed" - name: Delete the inventory - tower_inventory: + inventory: description: Test inventory organization: Default name: "{{ project_inv }}" @@ -629,7 +629,7 @@ - "result is changed" - name: Delete the Demo Project - tower_project: + project: name: "{{ demo_project_name }}" organization: Default scm_type: git @@ -643,7 +643,7 @@ - "result is changed" - name: Delete the SCM Credential - tower_credential: + credential: name: "{{ scm_cred_name }}" organization: Default kind: scm From 7a63785255e04808d5cb8ca330d2fee31190cd9f Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Thu, 29 Apr 2021 11:58:41 -0400 Subject: [PATCH 03/31] more rename, mostly in test --- awx_collection/README.md | 5 +- awx_collection/TESTING.md | 4 +- .../plugins/doc_fragments/auth_legacy.py | 2 +- .../plugins/doc_fragments/auth_plugin.py | 10 +-- .../plugins/inventory/controller.py | 10 +-- .../plugins/lookup/controller_api.py | 16 ++-- .../plugins/module_utils/controller_api.py | 4 +- .../{legacy.py => tower_legacy.py} | 2 +- .../plugins/modules/ad_hoc_command.py | 6 +- .../plugins/modules/ad_hoc_command_cancel.py | 8 +- .../plugins/modules/ad_hoc_command_wait.py | 10 +-- awx_collection/plugins/modules/application.py | 10 +-- awx_collection/plugins/modules/credential.py | 26 +++---- .../modules/credential_input_source.py | 8 +- .../plugins/modules/credential_type.py | 12 +-- .../plugins/modules/execution_environment.py | 8 +- awx_collection/plugins/modules/export.py | 12 +-- awx_collection/plugins/modules/group.py | 10 +-- awx_collection/plugins/modules/host.py | 8 +- awx_collection/plugins/modules/import.py | 12 +-- .../plugins/modules/instance_group.py | 6 +- awx_collection/plugins/modules/inventory.py | 10 +-- .../plugins/modules/inventory_source.py | 8 +- .../modules/inventory_source_update.py | 10 +-- awx_collection/plugins/modules/job_cancel.py | 8 +- awx_collection/plugins/modules/job_launch.py | 12 +-- awx_collection/plugins/modules/job_list.py | 8 +- .../plugins/modules/job_template.py | 14 ++-- awx_collection/plugins/modules/job_wait.py | 10 +-- awx_collection/plugins/modules/label.py | 8 +- awx_collection/plugins/modules/license.py | 8 +- awx_collection/plugins/modules/meta.py | 6 +- .../plugins/modules/notification_template.py | 22 +++--- .../plugins/modules/organization.py | 12 +-- awx_collection/plugins/modules/project.py | 12 +-- .../plugins/modules/project_update.py | 10 +-- awx_collection/plugins/modules/receive.py | 12 +-- awx_collection/plugins/modules/role.py | 10 +-- awx_collection/plugins/modules/schedule.py | 10 +-- awx_collection/plugins/modules/send.py | 8 +- awx_collection/plugins/modules/settings.py | 14 ++-- awx_collection/plugins/modules/team.py | 8 +- awx_collection/plugins/modules/token.py | 20 ++--- awx_collection/plugins/modules/user.py | 14 ++-- .../plugins/modules/workflow_approval.py | 6 +- .../plugins/modules/workflow_job_template.py | 16 ++-- .../modules/workflow_job_template_node.py | 10 +-- .../plugins/modules/workflow_launch.py | 10 +-- .../plugins/modules/workflow_node_wait.py | 6 +- .../plugins/modules/workflow_template.py | 8 +- awx_collection/requirements.txt | 4 +- awx_collection/test/awx/test_ad_hoc_wait.py | 6 +- awx_collection/test/awx/test_application.py | 2 +- awx_collection/test/awx/test_completeness.py | 62 ++++++++-------- awx_collection/test/awx/test_credential.py | 14 ++-- .../test/awx/test_credential_input_source.py | 18 ++--- .../test/awx/test_credential_type.py | 6 +- awx_collection/test/awx/test_group.py | 10 +-- .../test/awx/test_instance_group.py | 10 +-- awx_collection/test/awx/test_inventory.py | 6 +- .../test/awx/test_inventory_source.py | 18 ++--- awx_collection/test/awx/test_job.py | 6 +- awx_collection/test/awx/test_job_template.py | 28 ++++--- awx_collection/test/awx/test_label.py | 6 +- awx_collection/test/awx/test_module_utils.py | 38 +++++----- .../test/awx/test_notification_template.py | 14 ++-- awx_collection/test/awx/test_organization.py | 2 +- awx_collection/test/awx/test_project.py | 2 +- awx_collection/test/awx/test_role.py | 10 +-- awx_collection/test/awx/test_schedule.py | 8 +- awx_collection/test/awx/test_send_receive.py | 4 +- awx_collection/test/awx/test_settings.py | 8 +- awx_collection/test/awx/test_team.py | 6 +- awx_collection/test/awx/test_token.py | 2 +- awx_collection/test/awx/test_user.py | 10 +-- .../test/awx/test_workflow_job_template.py | 22 +++--- .../awx/test_workflow_job_template_node.py | 8 +- .../test/awx/test_workflow_template.py | 8 +- .../targets/ad_hoc_command/tasks/main.yml | 6 +- .../ad_hoc_command_cancel/tasks/main.yml | 10 +-- .../ad_hoc_command_wait/tasks/main.yml | 14 ++-- .../credential_input_source/tasks/main.yml | 6 +- .../targets/credential_type/tasks/main.yml | 4 +- .../targets/demo_data/tasks/main.yml | 4 +- .../integration/targets/group/tasks/main.yml | 2 +- .../targets/instance_group/tasks/main.yml | 8 +- .../targets/inventory/tasks/main.yml | 4 +- .../targets/inventory_source/tasks/main.yml | 4 +- .../inventory_source_update/tasks/main.yml | 16 ++-- .../targets/job_cancel/tasks/main.yml | 8 +- .../targets/job_launch/tasks/main.yml | 30 ++++---- .../targets/job_list/tasks/main.yml | 8 +- .../targets/job_template/tasks/main.yml | 50 ++++++------- .../targets/job_wait/tasks/main.yml | 32 ++++---- .../targets/lookup_api_plugin/tasks/main.yml | 12 +-- .../notification_template/tasks/main.yml | 30 ++++---- .../targets/organization/tasks/main.yml | 4 +- .../targets/project/tasks/main.yml | 8 +- .../tasks/create_project_dir.yml | 4 +- .../targets/project_update/tasks/main.yml | 6 +- .../integration/targets/role/tasks/main.yml | 6 +- .../integration/targets/token/tasks/main.yml | 8 +- .../workflow_job_template/tasks/main.yml | 74 +++++++++---------- .../targets/workflow_launch/tasks/main.yml | 42 +++++------ .../tools/roles/generate/templates/module.j2 | 4 +- 105 files changed, 616 insertions(+), 625 deletions(-) rename awx_collection/plugins/module_utils/{legacy.py => tower_legacy.py} (98%) diff --git a/awx_collection/README.md b/awx_collection/README.md index 506d00e4a3..0a9e47a5ab 100644 --- a/awx_collection/README.md +++ b/awx_collection/README.md @@ -71,9 +71,8 @@ Notable releases of the `awx.awx` collection: The following notes are changes that may require changes to playbooks: + - The module tower_notification was renamed tower_notification_template. In ansible >= 2.10 there is a seemless redirect. Ansible 2.9 does not respect the redirect. - When a project is created, it will wait for the update/sync to finish by default; this can be turned off with the `wait` parameter, if desired. - - When using the wait parameter with project update, if the project did not undergo a revision update, the result will be - 'not changed' - Creating a "scan" type job template is no longer supported. - Specifying a custom certificate via the `TOWER_CERTIFICATE` environment variable no longer works. - Type changes of variable fields: @@ -118,7 +117,7 @@ py.test awx_collection/test/awx/ ## Running Integration Tests -The integration tests require a virtualenv with `ansible` >= 2.9 and `tower_cli`. +The integration tests require a virtualenv with `ansible` >= 2.9 and `awxkit`. The collection must first be installed, which can be done using `make install_collection`. You also need a configuration file, as described in the running section. diff --git a/awx_collection/TESTING.md b/awx_collection/TESTING.md index b2b24450d3..23a01c7ad5 100644 --- a/awx_collection/TESTING.md +++ b/awx_collection/TESTING.md @@ -35,7 +35,7 @@ def test_create_token(run_module, admin_user): 'tower_config_file': None, } - result = run_module('tower_token', module_args, admin_user) + result = run_module('token', module_args, admin_user) assert result.get('changed'), result tokens = OAuth2AccessToken.objects.filter(description='barfoo') @@ -128,7 +128,7 @@ While not strictly followed, the general flow of a test should be: - Cleanup created objects ``` - name: Delete the credential - tower_credential: + credential: name: "{{ cred_name1 }}" organization: "Default" credential_type: "OpenShift or Kubernetes API Bearer Token" diff --git a/awx_collection/plugins/doc_fragments/auth_legacy.py b/awx_collection/plugins/doc_fragments/auth_legacy.py index 29c91507f2..dcece09976 100644 --- a/awx_collection/plugins/doc_fragments/auth_legacy.py +++ b/awx_collection/plugins/doc_fragments/auth_legacy.py @@ -10,7 +10,7 @@ __metaclass__ = type class ModuleDocFragment(object): - # Ansible Tower documentation fragment + # Automation Controller documentation fragment DOCUMENTATION = r''' options: tower_host: diff --git a/awx_collection/plugins/doc_fragments/auth_plugin.py b/awx_collection/plugins/doc_fragments/auth_plugin.py index f3c49ca9ba..207100c193 100644 --- a/awx_collection/plugins/doc_fragments/auth_plugin.py +++ b/awx_collection/plugins/doc_fragments/auth_plugin.py @@ -10,19 +10,19 @@ __metaclass__ = type class ModuleDocFragment(object): - # Ansible Tower documentation fragment + # Automation Controller documentation fragment DOCUMENTATION = r''' options: host: - description: The network address of your Ansible Tower host. + description: The network address of your Automation Controller host. env: - name: TOWER_HOST username: - description: The user that you plan to use to access inventories on Ansible Tower. + description: The user that you plan to use to access inventories on Automation Controller. env: - name: TOWER_USERNAME password: - description: The password for your Ansible Tower user. + description: The password for your Automation Controller user. env: - name: TOWER_PASSWORD oauth_token: @@ -32,7 +32,7 @@ options: - name: TOWER_OAUTH_TOKEN verify_ssl: description: - - Specify whether Ansible should verify the SSL certificate of Ansible Tower host. + - Specify whether Ansible should verify the SSL certificate of Automation Controller host. - Defaults to True, but this is handled by the shared module_utils code type: bool env: diff --git a/awx_collection/plugins/inventory/controller.py b/awx_collection/plugins/inventory/controller.py index 5c14817707..1272d1b587 100644 --- a/awx_collection/plugins/inventory/controller.py +++ b/awx_collection/plugins/inventory/controller.py @@ -11,9 +11,9 @@ plugin_type: inventory author: - Matthew Jones (@matburt) - Yunfan Zhang (@YunfanZhang42) -short_description: Ansible dynamic inventory plugin for Ansible Tower. +short_description: Ansible dynamic inventory plugin for Automation Controller. description: - - Reads inventories from Ansible Tower. + - Reads inventories from Automation Controller. - Supports reading configuration from both YAML config file and environment variables. - If reading from the YAML file, the file name must end with tower.(yml|yaml) or tower_inventory.(yml|yaml), the path in the command would be /path/to/tower_inventory.(yml|yaml). If some arguments in the config file @@ -23,7 +23,7 @@ extends_documentation_fragment: awx.awx.auth_plugin options: inventory_id: description: - - The ID of the Ansible Tower inventory that you wish to import. + - The ID of the Automation Controller inventory that you wish to import. - This is allowed to be either the inventory primary key or its named URL slug. - Primary key values will be accepted as strings or integers, and URL slugs must be strings. - Named URL slugs follow the syntax of "inventory_name++organization_name". @@ -32,7 +32,7 @@ options: - name: TOWER_INVENTORY required: True include_metadata: - description: Make extra requests to provide all group vars with metadata about the source Ansible Tower host. + description: Make extra requests to provide all group vars with metadata about the source Automation Controller host. type: bool default: False ''' @@ -59,7 +59,7 @@ inventory_id: the_ID_of_targeted_ansible_tower_inventory # export TOWER_USERNAME=YOUR_TOWER_USERNAME # export TOWER_PASSWORD=YOUR_TOWER_PASSWORD # export TOWER_INVENTORY=THE_ID_OF_TARGETED_INVENTORY -# Read the inventory specified in TOWER_INVENTORY from Ansible Tower, and list them. +# Read the inventory specified in TOWER_INVENTORY from Automation Controller, and list them. # The inventory path must always be @tower_inventory if you are reading all settings from environment variables. # ansible-inventory -i @tower_inventory --list ''' diff --git a/awx_collection/plugins/lookup/controller_api.py b/awx_collection/plugins/lookup/controller_api.py index ee55a200ca..51657755b4 100644 --- a/awx_collection/plugins/lookup/controller_api.py +++ b/awx_collection/plugins/lookup/controller_api.py @@ -5,13 +5,13 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type DOCUMENTATION = """ -lookup: tower_api +lookup: controller_api author: John Westcott IV (@john-westcott-iv) short_description: Search the API for objects requirements: - None description: - - Returns GET requests from the Ansible Tower API. See + - Returns GET requests from the Automation Controller API. See U(https://docs.ansible.com/ansible-tower/latest/html/towerapi/index.html) for API usage. - For use that is cross-compatible between the awx.awx and ansible.tower collection see the tower_meta module @@ -71,20 +71,20 @@ notes: EXAMPLES = """ - name: Load the UI settings set_fact: - tower_settings: "{{ lookup('awx.awx.tower_api', 'settings/ui') }}" + tower_settings: "{{ lookup('awx.awx.controller_api', 'settings/ui') }}" - name: Load the UI settings specifying the connection info set_fact: - tower_settings: "{{ lookup('awx.awx.tower_api', 'settings/ui' host='tower.example.com', username='admin', password=my_pass_var, verify_ssl=False) }}" + tower_settings: "{{ lookup('awx.awx.controller_api', 'settings/ui' host='tower.example.com', username='admin', password=my_pass_var, verify_ssl=False) }}" - name: Report the usernames of all users with admin privs debug: - msg: "Admin users: {{ query('awx.awx.tower_api', 'users', query_params={ 'is_superuser': true }) | map(attribute='username') | join(', ') }}" + msg: "Admin users: {{ query('awx.awx.controller_api', 'users', query_params={ 'is_superuser': true }) | map(attribute='username') | join(', ') }}" - name: debug all organizations in a loop # use query to return a list debug: msg: "Organization description={{ item['description'] }} id={{ item['id'] }}" - loop: "{{ query('awx.awx.tower_api', 'organizations') }}" + loop: "{{ query('awx.awx.controller_api', 'organizations') }}" loop_control: label: "{{ item['name'] }}" @@ -93,7 +93,7 @@ EXAMPLES = """ organization: Default role: admin user: john - when: "lookup('awx.awx.tower_api', 'users', query_params={ 'username': 'john' }) | length == 1" + when: "lookup('awx.awx.controller_api', 'users', query_params={ 'username': 'john' }) | length == 1" - name: Create an inventory group with all 'foo' hosts tower_group: @@ -101,7 +101,7 @@ EXAMPLES = """ inventory: "Demo Inventory" hosts: >- {{ query( - 'awx.awx.tower_api', + 'awx.awx.controller_api', 'hosts', query_params={ 'name__startswith' : 'foo', }, ) | map(attribute='name') | list }} diff --git a/awx_collection/plugins/module_utils/controller_api.py b/awx_collection/plugins/module_utils/controller_api.py index 0d3aae956e..4a5de0f55e 100644 --- a/awx_collection/plugins/module_utils/controller_api.py +++ b/awx_collection/plugins/module_utils/controller_api.py @@ -21,7 +21,7 @@ class ControllerAPIModule(ControllerModule): # Those values can be found in awx/api/generics.py line 204 collection_to_version = { 'awx': 'AWX', - 'tower': 'Red Hat Ansible Tower', + 'tower': 'Red Hat Automation Controller', } session = None IDENTITY_FIELDS = {'users': 'username', 'workflow_job_template_nodes': 'identifier', 'instances': 'hostname'} @@ -302,7 +302,7 @@ class ControllerAPIModule(ControllerModule): # Attempt to get a token from /api/v2/tokens/ by giving it our username/password combo # If we have a username and password, we need to get a session cookie login_data = { - "description": "Ansible Tower Module Token", + "description": "Automation Controller Module Token", "application": None, "scope": "write", } diff --git a/awx_collection/plugins/module_utils/legacy.py b/awx_collection/plugins/module_utils/tower_legacy.py similarity index 98% rename from awx_collection/plugins/module_utils/legacy.py rename to awx_collection/plugins/module_utils/tower_legacy.py index faed980a8a..9e92e6429b 100644 --- a/awx_collection/plugins/module_utils/legacy.py +++ b/awx_collection/plugins/module_utils/tower_legacy.py @@ -83,7 +83,7 @@ def tower_auth_config(module): def tower_check_mode(module): - '''Execute check mode logic for Ansible Tower modules''' + '''Execute check mode logic for Automation Controller modules''' if module.check_mode: try: result = client.get('/ping').json() diff --git a/awx_collection/plugins/modules/ad_hoc_command.py b/awx_collection/plugins/modules/ad_hoc_command.py index 97f2d1072f..ae04b00963 100644 --- a/awx_collection/plugins/modules/ad_hoc_command.py +++ b/awx_collection/plugins/modules/ad_hoc_command.py @@ -14,12 +14,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_ad_hoc_command +module: ad_hoc_command author: "John Westcott IV (@john-westcott-iv)" version_added: "4.0" -short_description: create, update, or destroy Ansible Tower ad hoc commands. +short_description: create, update, or destroy Automation Controller ad hoc commands. description: - - Create, update, or destroy Ansible Tower ad hoc commands. See + - Create, update, or destroy Automation Controller ad hoc commands. See U(https://www.ansible.com/tower) for an overview. options: job_type: diff --git a/awx_collection/plugins/modules/ad_hoc_command_cancel.py b/awx_collection/plugins/modules/ad_hoc_command_cancel.py index 400ef4af9b..40e51d93f2 100644 --- a/awx_collection/plugins/modules/ad_hoc_command_cancel.py +++ b/awx_collection/plugins/modules/ad_hoc_command_cancel.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_ad_hoc_command_cancel +module: ad_hoc_command_cancel author: "John Westcott IV (@john-westcott-iv)" -short_description: Cancel an Ansible Tower Ad Hoc Command. +short_description: Cancel an Automation Controller Ad Hoc Command. description: - - Cancel Ansible Tower ad hoc command. See + - Cancel Automation Controller ad hoc command. See U(https://www.ansible.com/tower) for an overview. options: command_id: @@ -47,7 +47,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Cancel command - tower_ad_hoc_command_cancel: + ad_hoc_command_cancel: command_id: command.id ''' diff --git a/awx_collection/plugins/modules/ad_hoc_command_wait.py b/awx_collection/plugins/modules/ad_hoc_command_wait.py index 21f4e9b348..f547b93c06 100644 --- a/awx_collection/plugins/modules/ad_hoc_command_wait.py +++ b/awx_collection/plugins/modules/ad_hoc_command_wait.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_ad_hoc_command_wait +module: ad_hoc_command_wait author: "John Westcott IV (@john-westcott-iv)" -short_description: Wait for Ansible Tower Ad Hoc Command to finish. +short_description: Wait for Automation Controller Ad Hoc Command to finish. description: - - Wait for Ansible Tower ad hoc command to finish and report success or failure. See + - Wait for Automation Controller ad hoc command to finish and report success or failure. See U(https://www.ansible.com/tower) for an overview. options: command_id: @@ -41,14 +41,14 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Launch an ad hoc command - tower_ad_hoc_command: + ad_hoc_command: inventory: "Demo Inventory" credential: "Demo Credential" wait: false register: command - name: Wait for ad joc command max 120s - tower_ad_hoc_command_wait: + ad_hoc_command_wait: command_id: "{{ command.id }}" timeout: 120 ''' diff --git a/awx_collection/plugins/modules/application.py b/awx_collection/plugins/modules/application.py index 8fcf4f79dd..c8602a3281 100644 --- a/awx_collection/plugins/modules/application.py +++ b/awx_collection/plugins/modules/application.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_application +module: application author: "Geoffrey Bacheot (@jffz)" -short_description: create, update, or destroy Ansible Tower applications +short_description: create, update, or destroy Automation Controller applications description: - - Create, update, or destroy Ansible Tower applications. See + - Create, update, or destroy Automation Controller applications. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -69,7 +69,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Add Foo application - tower_application: + application: name: "Foo" description: "Foo bar application" organization: "test" @@ -78,7 +78,7 @@ EXAMPLES = ''' client-type: public - name: Add Foo application - tower_application: + application: name: "Foo" description: "Foo bar application" organization: "test" diff --git a/awx_collection/plugins/modules/credential.py b/awx_collection/plugins/modules/credential.py index 46e2c712dd..9cc84f6e72 100644 --- a/awx_collection/plugins/modules/credential.py +++ b/awx_collection/plugins/modules/credential.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_credential +module: credential author: "Wayne Witzel III (@wwitzel3)" -short_description: create, update, or destroy Ansible Tower credential. +short_description: create, update, or destroy Automation Controller credential. description: - - Create, update, or destroy Ansible Tower credentials. See + - Create, update, or destroy Automation Controller credentials. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -56,7 +56,7 @@ options: description: - >- Credential inputs where the keys are var names used in templating. - Refer to the Ansible Tower documentation for example syntax. + Refer to the Automation Controller documentation for example syntax. - Any fields in this dict will take prescedence over any fields mentioned below (i.e. host, username, etc) type: dict update_secrets: @@ -204,7 +204,7 @@ notes: EXAMPLES = ''' - name: Add tower machine credential - tower_credential: + credential: name: Team Name description: Team Description organization: test-org @@ -213,7 +213,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" - name: Create a valid SCM credential from a private_key file - tower_credential: + credential: name: SCM Credential organization: Default state: present @@ -230,7 +230,7 @@ EXAMPLES = ''' register: aws_ssh_key - name: Add Credential Into Tower - tower_credential: + credential: name: Workshop Credential credential_type: Machine organization: Default @@ -240,7 +240,7 @@ EXAMPLES = ''' delegate_to: localhost - name: Add Credential with Custom Credential Type - tower_credential: + credential: name: Workshop Credential credential_type: MyCloudCredential organization: Default @@ -249,7 +249,7 @@ EXAMPLES = ''' tower_host: https://localhost - name: Create a Vaiult credential (example for notes) - tower_credential: + credential: name: Example password credential_type: Vault organization: Default @@ -258,7 +258,7 @@ EXAMPLES = ''' vault_id: 'My ID' - name: Bad password update (will replace vault_id) - tower_credential: + credential: name: Example password credential_type: Vault organization: Default @@ -266,14 +266,14 @@ EXAMPLES = ''' vault_password: 'new_password' - name: Another bad password update (will replace vault_id) - tower_credential: + credential: name: Example password credential_type: Vault organization: Default vault_password: 'new_password' - name: A safe way to update a password and keep vault_id - tower_credential: + credential: name: Example password credential_type: Vault organization: Default @@ -282,7 +282,7 @@ EXAMPLES = ''' vault_id: 'My ID' - name: Copy Credential - tower_credential: + credential: name: Copy password copy_from: Example password credential_type: Vault diff --git a/awx_collection/plugins/modules/credential_input_source.py b/awx_collection/plugins/modules/credential_input_source.py index 9e4303a5bd..de1b8e25e2 100644 --- a/awx_collection/plugins/modules/credential_input_source.py +++ b/awx_collection/plugins/modules/credential_input_source.py @@ -14,12 +14,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_credential_input_source +module: credential_input_source author: "Tom Page (@Tompage1994)" version_added: "2.3" -short_description: create, update, or destroy Ansible Tower credential input sources. +short_description: create, update, or destroy Automation Controller credential input sources. description: - - Create, update, or destroy Ansible Tower credential input sources. See + - Create, update, or destroy Automation Controller credential input sources. See U(https://www.ansible.com/tower) for an overview. options: description: @@ -58,7 +58,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Use CyberArk Lookup credential as password source - tower_credential_input_source: + credential_input_source: input_field_name: password target_credential: new_cred source_credential: cyberark_lookup diff --git a/awx_collection/plugins/modules/credential_type.py b/awx_collection/plugins/modules/credential_type.py index af0869d2c4..7dff67bc5f 100644 --- a/awx_collection/plugins/modules/credential_type.py +++ b/awx_collection/plugins/modules/credential_type.py @@ -15,11 +15,11 @@ ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'metadat DOCUMENTATION = ''' --- -module: tower_credential_type +module: credential_type author: "Adrien Fleury (@fleu42)" -short_description: Create, update, or destroy custom Ansible Tower credential type. +short_description: Create, update, or destroy custom Automation Controller credential type. description: - - Create, update, or destroy Ansible Tower credential type. See + - Create, update, or destroy Automation Controller credential type. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -49,7 +49,7 @@ options: description: - >- Enter injectors using either JSON or YAML syntax. Refer to the - Ansible Tower documentation for example syntax. + Automation Controller documentation for example syntax. type: dict state: description: @@ -62,7 +62,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' -- tower_credential_type: +- credential_type: name: Nexus description: Credentials type for Nexus kind: cloud @@ -71,7 +71,7 @@ EXAMPLES = ''' state: present validate_certs: false -- tower_credential_type: +- credential_type: name: Nexus state: absent ''' diff --git a/awx_collection/plugins/modules/execution_environment.py b/awx_collection/plugins/modules/execution_environment.py index fc9ecc19a0..a419b0697b 100644 --- a/awx_collection/plugins/modules/execution_environment.py +++ b/awx_collection/plugins/modules/execution_environment.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_execution_environment +module: execution_environment author: "Shane McDonald (@shanemcd)" -short_description: create, update, or destroy Execution Environments in Ansible Tower. +short_description: create, update, or destroy Execution Environments in Automation Controller. description: - - Create, update, or destroy Execution Environments in Ansible Tower. See + - Create, update, or destroy Execution Environments in Automation Controller. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -61,7 +61,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Add EE to Tower - tower_execution_environment: + execution_environment: name: "My EE" image: quay.io/ansible/awx-ee ''' diff --git a/awx_collection/plugins/modules/export.py b/awx_collection/plugins/modules/export.py index 370ff8e685..c50632ee6b 100644 --- a/awx_collection/plugins/modules/export.py +++ b/awx_collection/plugins/modules/export.py @@ -14,12 +14,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_export +module: export author: "John Westcott IV (@john-westcott-iv)" version_added: "3.7" -short_description: export resources from Ansible Tower. +short_description: export resources from Automation Controller. description: - - Export assets from Ansible Tower. + - Export assets from Automation Controller. options: all: description: @@ -83,15 +83,15 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Export all tower assets - tower_export: + export: all: True - name: Export all inventories - tower_export: + export: inventory: 'all' - name: Export a job template named "My Template" and all Credentials - tower_export: + export: job_template: "My Template" credential: 'all' ''' diff --git a/awx_collection/plugins/modules/group.py b/awx_collection/plugins/modules/group.py index f7785da2be..8a9fe46673 100644 --- a/awx_collection/plugins/modules/group.py +++ b/awx_collection/plugins/modules/group.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_group +module: group author: "Wayne Witzel III (@wwitzel3)" -short_description: create, update, or destroy Ansible Tower group. +short_description: create, update, or destroy Automation Controller group. description: - - Create, update, or destroy Ansible Tower groups. See + - Create, update, or destroy Automation Controller groups. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -79,7 +79,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Add tower group - tower_group: + group: name: localhost description: "Local Host Group" inventory: "Local Inventory" @@ -87,7 +87,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" - name: Add tower group - tower_group: + group: name: Cities description: "Local Host Group" inventory: Default Inventory diff --git a/awx_collection/plugins/modules/host.py b/awx_collection/plugins/modules/host.py index d5e711dd93..edb343e1de 100644 --- a/awx_collection/plugins/modules/host.py +++ b/awx_collection/plugins/modules/host.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_host +module: host author: "Wayne Witzel III (@wwitzel3)" -short_description: create, update, or destroy Ansible Tower host. +short_description: create, update, or destroy Automation Controller host. description: - - Create, update, or destroy Ansible Tower hosts. See + - Create, update, or destroy Automation Controller hosts. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -60,7 +60,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Add tower host - tower_host: + host: name: localhost description: "Local Host Group" inventory: "Local Inventory" diff --git a/awx_collection/plugins/modules/import.py b/awx_collection/plugins/modules/import.py index 89142532ad..b88ae41d59 100644 --- a/awx_collection/plugins/modules/import.py +++ b/awx_collection/plugins/modules/import.py @@ -14,12 +14,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_import +module: import author: "John Westcott (@john-westcott-iv)" version_added: "3.7" -short_description: import resources into Ansible Tower. +short_description: import resources into Automation Controller. description: - - Import assets into Ansible Tower. See + - Import assets into Automation Controller. See U(https://www.ansible.com/tower) for an overview. options: assets: @@ -35,16 +35,16 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Export all assets - tower_export: + export: all: True register: export_output - name: Import all tower assets from our export - tower_import: + import: assets: "{{ export_output.assets }}" - name: Load data from a json file created by a command like awx export --organization Default - tower_import: + import: assets: "{{ lookup('file', 'org.json') | from_json() }}" ''' diff --git a/awx_collection/plugins/modules/instance_group.py b/awx_collection/plugins/modules/instance_group.py index 65f0d27ee8..37246d5e60 100644 --- a/awx_collection/plugins/modules/instance_group.py +++ b/awx_collection/plugins/modules/instance_group.py @@ -14,12 +14,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_instance_group +module: instance_group author: "John Westcott IV (@john-westcott-iv)" version_added: "4.0" -short_description: create, update, or destroy Ansible Tower instance groups. +short_description: create, update, or destroy Automation Controller instance groups. description: - - Create, update, or destroy Ansible Tower instance groups. See + - Create, update, or destroy Automation Controller instance groups. See U(https://www.ansible.com/tower) for an overview. options: name: diff --git a/awx_collection/plugins/modules/inventory.py b/awx_collection/plugins/modules/inventory.py index 25b75358f3..4f4d6ac833 100644 --- a/awx_collection/plugins/modules/inventory.py +++ b/awx_collection/plugins/modules/inventory.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_inventory +module: inventory author: "Wayne Witzel III (@wwitzel3)" -short_description: create, update, or destroy Ansible Tower inventory. +short_description: create, update, or destroy Automation Controller inventory. description: - - Create, update, or destroy Ansible Tower inventories. See + - Create, update, or destroy Automation Controller inventories. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -78,7 +78,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Add tower inventory - tower_inventory: + inventory: name: "Foo Inventory" description: "Our Foo Cloud Servers" organization: "Bar Org" @@ -86,7 +86,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" - name: Copy tower inventory - tower_inventory: + inventory: name: Copy Foo Inventory copy_from: Default Inventory description: "Our Foo Cloud Servers" diff --git a/awx_collection/plugins/modules/inventory_source.py b/awx_collection/plugins/modules/inventory_source.py index 4ab2dd192f..65168c321b 100644 --- a/awx_collection/plugins/modules/inventory_source.py +++ b/awx_collection/plugins/modules/inventory_source.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_inventory_source +module: inventory_source author: "Adrien Fleury (@fleu42)" -short_description: create, update, or destroy Ansible Tower inventory source. +short_description: create, update, or destroy Automation Controller inventory source. description: - - Create, update, or destroy Ansible Tower inventory source. See + - Create, update, or destroy Automation Controller inventory source. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -138,7 +138,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Add an inventory source - tower_inventory_source: + inventory_source: name: "source-inventory" description: Source for inventory inventory: previously-created-inventory diff --git a/awx_collection/plugins/modules/inventory_source_update.py b/awx_collection/plugins/modules/inventory_source_update.py index 703c3ca4e7..07aca6dca4 100644 --- a/awx_collection/plugins/modules/inventory_source_update.py +++ b/awx_collection/plugins/modules/inventory_source_update.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_inventory_source_update +module: inventory_source_update author: "Bianca Henderson (@beeankha)" short_description: Update inventory source(s). description: - - Update Ansible Tower inventory source(s). See + - Update Automation Controller inventory source(s). See U(https://www.ansible.com/tower) for an overview. options: name: @@ -58,16 +58,16 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Update a single inventory source - tower_inventory_source_update: + inventory_source_update: name: "Example Inventory Source" inventory: "My Inventory" organization: Default - name: Update all inventory sources - tower_inventory_source_update: + inventory_source_update: name: "{{ item }}" inventory: "My Other Inventory" - loop: "{{ query('awx.awx.tower_api', 'inventory_sources', query_params={ 'inventory': 30 }, return_ids=True ) }}" + loop: "{{ query('awx.awx.controller_api', 'inventory_sources', query_params={ 'inventory': 30 }, return_ids=True ) }}" ''' RETURN = ''' diff --git a/awx_collection/plugins/modules/job_cancel.py b/awx_collection/plugins/modules/job_cancel.py index c56a4efa3f..5a2d071ef3 100644 --- a/awx_collection/plugins/modules/job_cancel.py +++ b/awx_collection/plugins/modules/job_cancel.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_job_cancel +module: job_cancel author: "Wayne Witzel III (@wwitzel3)" -short_description: Cancel an Ansible Tower Job. +short_description: Cancel an Automation Controller Job. description: - - Cancel Ansible Tower jobs. See + - Cancel Automation Controller jobs. See U(https://www.ansible.com/tower) for an overview. options: job_id: @@ -36,7 +36,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Cancel job - tower_job_cancel: + job_cancel: job_id: job.id ''' diff --git a/awx_collection/plugins/modules/job_launch.py b/awx_collection/plugins/modules/job_launch.py index e211d5654a..52edec1762 100644 --- a/awx_collection/plugins/modules/job_launch.py +++ b/awx_collection/plugins/modules/job_launch.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_job_launch +module: job_launch author: "Wayne Witzel III (@wwitzel3)" short_description: Launch an Ansible Job. description: - - Launch an Ansible Tower jobs. See + - Launch an Automation Controller jobs. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -107,12 +107,12 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Launch a job - tower_job_launch: + job_launch: job_template: "My Job Template" register: job - name: Launch a job template with extra_vars on remote Tower instance - tower_job_launch: + job_launch: job_template: "My Job Template" extra_vars: var1: "My First Variable" @@ -121,13 +121,13 @@ EXAMPLES = ''' job_type: run - name: Launch a job with inventory and credential - tower_job_launch: + job_launch: job_template: "My Job Template" inventory: "My Inventory" credential: "My Credential" register: job - name: Wait for job max 120s - tower_job_wait: + job_wait: job_id: "{{ job.id }}" timeout: 120 ''' diff --git a/awx_collection/plugins/modules/job_list.py b/awx_collection/plugins/modules/job_list.py index 43a454a5da..831b722c69 100644 --- a/awx_collection/plugins/modules/job_list.py +++ b/awx_collection/plugins/modules/job_list.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_job_list +module: job_list author: "Wayne Witzel III (@wwitzel3)" -short_description: List Ansible Tower jobs. +short_description: List Automation Controller jobs. description: - - List Ansible Tower jobs. See + - List Automation Controller jobs. See U(https://www.ansible.com/tower) for an overview. options: status: @@ -45,7 +45,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: List running jobs for the testing.yml playbook - tower_job_list: + job_list: status: running query: {"playbook": "testing.yml"} tower_config_file: "~/tower_cli.cfg" diff --git a/awx_collection/plugins/modules/job_template.py b/awx_collection/plugins/modules/job_template.py index 8cf6ae8b9a..24711cfd4c 100644 --- a/awx_collection/plugins/modules/job_template.py +++ b/awx_collection/plugins/modules/job_template.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_job_template +module: job_template author: "Wayne Witzel III (@wwitzel3)" -short_description: create, update, or destroy Ansible Tower job templates. +short_description: create, update, or destroy Automation Controller job templates. description: - - Create, update, or destroy Ansible Tower job templates. See + - Create, update, or destroy Automation Controller job templates. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -305,7 +305,7 @@ notes: EXAMPLES = ''' - name: Create Tower Ping job template - tower_job_template: + job_template: name: "Ping" job_type: "run" organization: "Default" @@ -320,20 +320,20 @@ EXAMPLES = ''' survey_spec: "{{ lookup('file', 'my_survey.json') }}" - name: Add start notification to Job Template - tower_job_template: + job_template: name: "Ping" notification_templates_started: - Notification1 - Notification2 - name: Remove Notification1 start notification from Job Template - tower_job_template: + job_template: name: "Ping" notification_templates_started: - Notification2 - name: Copy Job Template - tower_job_template: + job_template: name: copy job template copy_from: test job template job_type: "run" diff --git a/awx_collection/plugins/modules/job_wait.py b/awx_collection/plugins/modules/job_wait.py index 52ab4a8dd4..4c10adffed 100644 --- a/awx_collection/plugins/modules/job_wait.py +++ b/awx_collection/plugins/modules/job_wait.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_job_wait +module: job_wait author: "Wayne Witzel III (@wwitzel3)" -short_description: Wait for Ansible Tower job to finish. +short_description: Wait for Automation Controller job to finish. description: - - Wait for Ansible Tower job to finish and report success or failure. See + - Wait for Automation Controller job to finish and report success or failure. See U(https://www.ansible.com/tower) for an overview. options: job_id: @@ -58,12 +58,12 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Launch a job - tower_job_launch: + job_launch: job_template: "My Job Template" register: job - name: Wait for job max 120s - tower_job_wait: + job_wait: job_id: "{{ job.id }}" timeout: 120 ''' diff --git a/awx_collection/plugins/modules/label.py b/awx_collection/plugins/modules/label.py index e231f4848b..c37c0335b2 100644 --- a/awx_collection/plugins/modules/label.py +++ b/awx_collection/plugins/modules/label.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_label +module: label author: "Wayne Witzel III (@wwitzel3)" -short_description: create, update, or destroy Ansible Tower labels. +short_description: create, update, or destroy Automation Controller labels. description: - - Create, update, or destroy Ansible Tower labels. See + - Create, update, or destroy Automation Controller labels. See U(https://www.ansible.com/tower) for an overview. - Note, labels can only be created via the Tower API, they can not be deleted. Once they are fully disassociated the API will clean them up on its own. @@ -48,7 +48,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Add label to tower organization - tower_label: + label: name: Custom Label organization: My Organization ''' diff --git a/awx_collection/plugins/modules/license.py b/awx_collection/plugins/modules/license.py index 185aa7dfc7..c8e3670d46 100644 --- a/awx_collection/plugins/modules/license.py +++ b/awx_collection/plugins/modules/license.py @@ -13,11 +13,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_license +module: license author: "John Westcott IV (@john-westcott-iv)" -short_description: Set the license for Ansible Tower +short_description: Set the license for Automation Controller description: - - Get or Set Ansible Tower license. See + - Get or Set Automation Controller license. See U(https://www.ansible.com/tower) for an overview. options: manifest: @@ -39,7 +39,7 @@ RETURN = ''' # ''' EXAMPLES = ''' - name: Set the license using a file - tower_license: + license: manifest: "/tmp/my_manifest.zip" ''' diff --git a/awx_collection/plugins/modules/meta.py b/awx_collection/plugins/modules/meta.py index cc742f20de..dafa023a25 100644 --- a/awx_collection/plugins/modules/meta.py +++ b/awx_collection/plugins/modules/meta.py @@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_meta +module: meta author: "Alan Rominger (@alancoding)" short_description: Returns metadata about the collection this module lives in. description: @@ -49,7 +49,7 @@ version: EXAMPLES = ''' -- tower_meta: +- meta: register: result - name: Show details about the collection @@ -57,7 +57,7 @@ EXAMPLES = ''' - name: Load the UI setting without hard-coding the collection name debug: - msg: "{{ lookup(result.prefix + '.tower_api', 'settings/ui') }}" + msg: "{{ lookup(result.prefix + '.controller_api', 'settings/ui') }}" ''' diff --git a/awx_collection/plugins/modules/notification_template.py b/awx_collection/plugins/modules/notification_template.py index 11a24abe3b..78a0d6e147 100644 --- a/awx_collection/plugins/modules/notification_template.py +++ b/awx_collection/plugins/modules/notification_template.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_notification_template +module: notification_template author: "Samuel Carpentier (@samcarpentier)" -short_description: create, update, or destroy Ansible Tower notification. +short_description: create, update, or destroy Automation Controller notification. description: - - Create, update, or destroy Ansible Tower notifications. See + - Create, update, or destroy Automation Controller notifications. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -210,7 +210,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Add Slack notification with custom messages - tower_notification_template: + notification_template: name: slack notification organization: Default notification_type: slack @@ -229,7 +229,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" - name: Add webhook notification - tower_notification_template: + notification_template: name: webhook notification notification_type: webhook notification_configuration: @@ -240,7 +240,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" - name: Add email notification - tower_notification_template: + notification_template: name: email notification notification_type: email notification_configuration: @@ -257,7 +257,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" - name: Add twilio notification - tower_notification_template: + notification_template: name: twilio notification notification_type: twilio notification_configuration: @@ -270,7 +270,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" - name: Add PagerDuty notification - tower_notification_template: + notification_template: name: pagerduty notification notification_type: pagerduty notification_configuration: @@ -282,7 +282,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" - name: Add IRC notification - tower_notification_template: + notification_template: name: irc notification notification_type: irc notification_configuration: @@ -297,13 +297,13 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" - name: Delete notification - tower_notification_template: + notification_template: name: old notification state: absent tower_config_file: "~/tower_cli.cfg" - name: Copy webhook notification - tower_notification_template: + notification_template: name: foo notification copy_from: email notification organization: Foo diff --git a/awx_collection/plugins/modules/organization.py b/awx_collection/plugins/modules/organization.py index b7206e4a1d..ef255b859b 100644 --- a/awx_collection/plugins/modules/organization.py +++ b/awx_collection/plugins/modules/organization.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_organization +module: organization author: "Wayne Witzel III (@wwitzel3)" -short_description: create, update, or destroy Ansible Tower organizations +short_description: create, update, or destroy Automation Controller organizations description: - - Create, update, or destroy Ansible Tower organizations. See + - Create, update, or destroy Automation Controller organizations. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -87,21 +87,21 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Create tower organization - tower_organization: + organization: name: "Foo" description: "Foo bar organization" state: present tower_config_file: "~/tower_cli.cfg" - name: Create tower organization using 'foo-venv' as default Python virtualenv - tower_organization: + organization: name: "Foo" description: "Foo bar organization using foo-venv" state: present tower_config_file: "~/tower_cli.cfg" - name: Create tower organization that pulls content from galaxy.ansible.com - tower_organization: + organization: name: "Foo" state: present galaxy_credentials: diff --git a/awx_collection/plugins/modules/project.py b/awx_collection/plugins/modules/project.py index 98e7e34691..e3e296490c 100644 --- a/awx_collection/plugins/modules/project.py +++ b/awx_collection/plugins/modules/project.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_project +module: project author: "Wayne Witzel III (@wwitzel3)" -short_description: create, update, or destroy Ansible Tower projects +short_description: create, update, or destroy Automation Controller projects description: - - Create, update, or destroy Ansible Tower projects. See + - Create, update, or destroy Automation Controller projects. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -171,7 +171,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Add tower project - tower_project: + project: name: "Foo" description: "Foo bar project" organization: "test" @@ -179,7 +179,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" - name: Add Tower Project with cache timeout - tower_project: + project: name: "Foo" description: "Foo bar project" organization: "test" @@ -189,7 +189,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" - name: Copy tower project - tower_project: + project: name: copy copy_from: test description: Foo copy project diff --git a/awx_collection/plugins/modules/project_update.py b/awx_collection/plugins/modules/project_update.py index 0371343734..9931b9766f 100644 --- a/awx_collection/plugins/modules/project_update.py +++ b/awx_collection/plugins/modules/project_update.py @@ -11,11 +11,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_project_update +module: project_update author: "Sean Sullivan (@sean-m-sullivan)" -short_description: Update a Project in Ansible Tower +short_description: Update a Project in Automation Controller description: - - Update a Ansible Tower Project. See + - Update a Automation Controller Project. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -67,12 +67,12 @@ status: EXAMPLES = ''' - name: Launch a project with a timeout of 10 seconds - tower_project_update: + project_update: project: "Networking Project" timeout: 10 - name: Launch a Project with extra_vars without waiting - tower_project_update: + project_update: project: "Networking Project" wait: False ''' diff --git a/awx_collection/plugins/modules/receive.py b/awx_collection/plugins/modules/receive.py index d2031d6667..194bd6d347 100644 --- a/awx_collection/plugins/modules/receive.py +++ b/awx_collection/plugins/modules/receive.py @@ -14,15 +14,15 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['deprecated'], 'suppor DOCUMENTATION = ''' --- -module: tower_receive +module: receive deprecated: removed_in: "14.0.0" why: Deprecated in favor of upcoming C(_export) module. alternative: Once published, use M(tower_export) instead. author: "John Westcott IV (@john-westcott-iv)" -short_description: Receive assets from Ansible Tower. +short_description: Receive assets from Automation Controller. description: - - Receive assets from Ansible Tower. See + - Receive assets from Automation Controller. See U(https://www.ansible.com/tower) for an overview. options: all: @@ -102,17 +102,17 @@ extends_documentation_fragment: awx.awx.auth_legacy EXAMPLES = ''' - name: Export all tower assets - tower_receive: + receive: all: True tower_config_file: "~/tower_cli.cfg" - name: Export all inventories - tower_receive: + receive: inventory: - all - name: Export a job template named "My Template" and all Credentials - tower_receive: + receive: job_template: - "My Template" credential: diff --git a/awx_collection/plugins/modules/role.py b/awx_collection/plugins/modules/role.py index 5cfda7fa48..915a0b4fc6 100644 --- a/awx_collection/plugins/modules/role.py +++ b/awx_collection/plugins/modules/role.py @@ -14,12 +14,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_role +module: role author: "Wayne Witzel III (@wwitzel3)" -short_description: grant or revoke an Ansible Tower role. +short_description: grant or revoke an Automation Controller role. description: - Roles are used for access control, this module is for managing user access to server resources. - - Grant or revoke Ansible Tower roles to users. See U(https://www.ansible.com/tower) for an overview. + - Grant or revoke Automation Controller roles to users. See U(https://www.ansible.com/tower) for an overview. options: user: description: @@ -131,14 +131,14 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Add jdoe to the member role of My Team - tower_role: + role: user: jdoe target_team: "My Team" role: member state: present - name: Add Joe to multiple job templates and a workflow - tower_role: + role: user: joe role: execute workflow: test-role-workflow diff --git a/awx_collection/plugins/modules/schedule.py b/awx_collection/plugins/modules/schedule.py index 33f1a4b4bb..b2c06277a5 100644 --- a/awx_collection/plugins/modules/schedule.py +++ b/awx_collection/plugins/modules/schedule.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_schedule +module: schedule author: "John Westcott IV (@john-westcott-iv)" -short_description: create, update, or destroy Ansible Tower schedules. +short_description: create, update, or destroy Automation Controller schedules. description: - - Create, update, or destroy Ansible Tower schedules. See + - Create, update, or destroy Automation Controller schedules. See U(https://www.ansible.com/tower) for an overview. options: rrule: @@ -119,7 +119,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Build a schedule for Demo Job Template - tower_schedule: + schedule: name: "{{ sched1 }}" state: present unified_job_template: "Demo Job Template" @@ -127,7 +127,7 @@ EXAMPLES = ''' register: result - name: Build the same schedule using the rrule plugin - tower_schedule: + schedule: name: "{{ sched1 }}" state: present unified_job_template: "Demo Job Template" diff --git a/awx_collection/plugins/modules/send.py b/awx_collection/plugins/modules/send.py index dd87174b61..1b06829b8f 100644 --- a/awx_collection/plugins/modules/send.py +++ b/awx_collection/plugins/modules/send.py @@ -14,15 +14,15 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['deprecated'], 'suppor DOCUMENTATION = ''' --- -module: tower_send +module: send deprecated: removed_in: "14.0.0" why: Deprecated in favor of upcoming C(_import) module. alternative: Once published, use M(tower_import) instead. author: "John Westcott IV (@john-westcott-iv)" -short_description: Send assets to Ansible Tower. +short_description: Send assets to Automation Controller. description: - - Send assets to Ansible Tower. See + - Send assets to Automation Controller. See U(https://www.ansible.com/tower) for an overview. options: assets: @@ -63,7 +63,7 @@ extends_documentation_fragment: awx.awx.auth_legacy EXAMPLES = ''' - name: Import all tower assets - tower_send: + send: assets: "{{ export_output.assets }}" tower_config_file: "~/tower_cli.cfg" ''' diff --git a/awx_collection/plugins/modules/settings.py b/awx_collection/plugins/modules/settings.py index 4cfbc2aae3..e77dd69a29 100644 --- a/awx_collection/plugins/modules/settings.py +++ b/awx_collection/plugins/modules/settings.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_settings +module: settings author: "Nikhil Jain (@jainnikhil30)" -short_description: Modify Ansible Tower settings. +short_description: Modify Automation Controller settings. description: - - Modify Ansible Tower settings. See + - Modify Automation Controller settings. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -42,25 +42,25 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Set the value of AWX_ISOLATION_BASE_PATH - tower_settings: + settings: name: AWX_ISOLATION_BASE_PATH value: "/tmp" register: testing_settings - name: Set the value of AWX_ISOLATION_SHOW_PATHS - tower_settings: + settings: name: "AWX_ISOLATION_SHOW_PATHS" value: "'/var/lib/awx/projects/', '/tmp'" register: testing_settings - name: Set the LDAP Auth Bind Password - tower_settings: + settings: name: "AUTH_LDAP_BIND_PASSWORD" value: "Password" no_log: true - name: Set all the LDAP Auth Bind Params - tower_settings: + settings: settings: AUTH_LDAP_BIND_PASSWORD: "password" AUTH_LDAP_USER_ATTR_MAP: diff --git a/awx_collection/plugins/modules/team.py b/awx_collection/plugins/modules/team.py index d47e41d79a..ce51519b67 100644 --- a/awx_collection/plugins/modules/team.py +++ b/awx_collection/plugins/modules/team.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_team +module: team author: "Wayne Witzel III (@wwitzel3)" -short_description: create, update, or destroy Ansible Tower team. +short_description: create, update, or destroy Automation Controller team. description: - - Create, update, or destroy Ansible Tower teams. See + - Create, update, or destroy Automation Controller teams. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -51,7 +51,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Create tower team - tower_team: + team: name: Team Name description: Team Description organization: test-org diff --git a/awx_collection/plugins/modules/token.py b/awx_collection/plugins/modules/token.py index 85ac7f04c8..2f5bf2ffe3 100644 --- a/awx_collection/plugins/modules/token.py +++ b/awx_collection/plugins/modules/token.py @@ -14,12 +14,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_token +module: token author: "John Westcott IV (@john-westcott-iv)" version_added: "2.3" -short_description: create, update, or destroy Ansible Tower tokens. +short_description: create, update, or destroy Automation Controller tokens. description: - - Create or destroy Ansible Tower tokens. See + - Create or destroy Automation Controller tokens. See U(https://www.ansible.com/tower) for an overview. - In addition, the module sets an Ansible fact which can be passed into other tower_* modules as the parameter tower_oauthtoken. See examples for usage. @@ -66,19 +66,19 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - block: - name: Create a new token using an existing token - tower_token: + token: description: '{{ token_description }}' scope: "write" state: present tower_oauthtoken: "{{ my_existing_token }}" - name: Delete this token - tower_token: + token: existing_token: "{{ tower_token }}" state: absent - name: Create a new token using username/password - tower_token: + token: description: '{{ token_description }}' scope: "write" state: present @@ -86,24 +86,24 @@ EXAMPLES = ''' tower_password: "{{ my_password }}" - name: Use our new token to make another call - tower_job_list: + job_list: tower_oauthtoken: "{{ tower_token }}" always: - name: Delete our Token with the token we created - tower_token: + token: existing_token: "{{ tower_token }}" state: absent when: tower_token is defined - name: Delete a token by its id - tower_token: + token: existing_token_id: 4 state: absent ''' RETURN = ''' -tower_token: +token: type: dict description: An Ansible Fact variable representing a Tower token object which can be used for auth in subsequent modules. See examples for usage. contains: diff --git a/awx_collection/plugins/modules/user.py b/awx_collection/plugins/modules/user.py index d1ab5841ea..ca8ba710b8 100644 --- a/awx_collection/plugins/modules/user.py +++ b/awx_collection/plugins/modules/user.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_user +module: user author: "John Westcott IV (@john-westcott-iv)" -short_description: create, update, or destroy Ansible Tower users. +short_description: create, update, or destroy Automation Controller users. description: - - Create, update, or destroy Ansible Tower users. See + - Create, update, or destroy Automation Controller users. See U(https://www.ansible.com/tower) for an overview. options: username: @@ -72,7 +72,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Add tower user - tower_user: + user: username: jdoe password: foobarbaz email: jdoe@example.org @@ -82,7 +82,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" - name: Add tower user as a system administrator - tower_user: + user: username: jdoe password: foobarbaz email: jdoe@example.org @@ -91,7 +91,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" - name: Add tower user as a system auditor - tower_user: + user: username: jdoe password: foobarbaz email: jdoe@example.org @@ -100,7 +100,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" - name: Delete tower user - tower_user: + user: username: jdoe email: jdoe@example.org state: absent diff --git a/awx_collection/plugins/modules/workflow_approval.py b/awx_collection/plugins/modules/workflow_approval.py index c4de175b80..07fb1f82eb 100644 --- a/awx_collection/plugins/modules/workflow_approval.py +++ b/awx_collection/plugins/modules/workflow_approval.py @@ -18,7 +18,7 @@ ANSIBLE_METADATA = { DOCUMENTATION = """ --- -module: tower_workflow_approval +module: workflow_approval author: "Sean Sullivan (@sean-m-sullivan)" short_description: Approve an approval node in a workflow job. description: @@ -58,13 +58,13 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = """ - name: Launch a workflow with a timeout of 10 seconds - tower_workflow_launch: + workflow_launch: workflow_template: "Test Workflow" wait: False register: workflow - name: Wait for approval node to activate and approve - tower_workflow_approval: + workflow_approval: workflow_job_id: "{{ workflow.id }}" name: Approve Me interval: 10 diff --git a/awx_collection/plugins/modules/workflow_job_template.py b/awx_collection/plugins/modules/workflow_job_template.py index 3f9c7aa183..5b42e95a9e 100644 --- a/awx_collection/plugins/modules/workflow_job_template.py +++ b/awx_collection/plugins/modules/workflow_job_template.py @@ -14,13 +14,13 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_workflow_job_template +module: workflow_job_template author: "John Westcott IV (@john-westcott-iv)" -short_description: create, update, or destroy Ansible Tower workflow job templates. +short_description: create, update, or destroy Automation Controller workflow job templates. description: - - Create, update, or destroy Ansible Tower workflow job templates. + - Create, update, or destroy Automation Controller workflow job templates. - Replaces the deprecated tower_workflow_template module. - - Use the tower_workflow_job_template_node after this, or use the schema paramater to build the workflow's graph + - Use the tower_workflow_job_template_node after this, or use the schema parameter to build the workflow's graph options: name: description: @@ -328,13 +328,13 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Create a workflow job template - tower_workflow_job_template: + workflow_job_template: name: example-workflow description: created by Ansible Playbook organization: Default - name: Create a workflow job template with schema in template - awx.awx.tower_workflow_job_template: + awx.awx.workflow_job_template: name: example-workflow inventory: Demo Inventory extra_vars: {'foo': 'bar', 'another-foo': {'barz': 'bar2'}} @@ -391,13 +391,13 @@ EXAMPLES = ''' register: result - name: Copy a workflow job template - tower_workflow_job_template: + workflow_job_template: name: copy-workflow copy_from: example-workflow organization: Foo - name: Create a workflow job template with schema in template - awx.awx.tower_workflow_job_template: + awx.awx.workflow_job_template: name: example-workflow inventory: Demo Inventory extra_vars: {'foo': 'bar', 'another-foo': {'barz': 'bar2'}} diff --git a/awx_collection/plugins/modules/workflow_job_template_node.py b/awx_collection/plugins/modules/workflow_job_template_node.py index bb05449bbf..ec841d2abd 100644 --- a/awx_collection/plugins/modules/workflow_job_template_node.py +++ b/awx_collection/plugins/modules/workflow_job_template_node.py @@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_workflow_job_template_node +module: workflow_job_template_node author: "John Westcott IV (@john-westcott-iv)" -short_description: create, update, or destroy Ansible Tower workflow job template nodes. +short_description: create, update, or destroy Automation Controller workflow job template nodes. description: - - Create, update, or destroy Ansible Tower workflow job template nodes. + - Create, update, or destroy Automation Controller workflow job template nodes. - Use this to build a graph for a workflow, which dictates what the workflow runs. - Replaces the deprecated tower_workflow_template module schema command. - You can create nodes first, and link them afterwards, and not worry about ordering. @@ -158,7 +158,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Create a node, follows tower_workflow_job_template example - tower_workflow_job_template_node: + workflow_job_template_node: identifier: my-first-node workflow: example-workflow unified_job_template: jt-for-node-use @@ -167,7 +167,7 @@ EXAMPLES = ''' foo_key: bar_value - name: Create parent node for prior node - tower_workflow_job_template_node: + workflow_job_template_node: identifier: my-root-node workflow: example-workflow unified_job_template: jt-for-node-use diff --git a/awx_collection/plugins/modules/workflow_launch.py b/awx_collection/plugins/modules/workflow_launch.py index 40f8c37717..f3854116b5 100644 --- a/awx_collection/plugins/modules/workflow_launch.py +++ b/awx_collection/plugins/modules/workflow_launch.py @@ -11,11 +11,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: tower_workflow_launch +module: workflow_launch author: "John Westcott IV (@john-westcott-iv)" -short_description: Run a workflow in Ansible Tower +short_description: Run a workflow in Automation Controller description: - - Launch an Ansible Tower workflows. See + - Launch an Automation Controller workflows. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -77,12 +77,12 @@ job_info: EXAMPLES = ''' - name: Launch a workflow with a timeout of 10 seconds - tower_workflow_launch: + workflow_launch: workflow_template: "Test Workflow" timeout: 10 - name: Launch a Workflow with extra_vars without waiting - tower_workflow_launch: + workflow_launch: workflow_template: "Test workflow" extra_vars: var1: My First Variable diff --git a/awx_collection/plugins/modules/workflow_node_wait.py b/awx_collection/plugins/modules/workflow_node_wait.py index 2e2e06ee35..a8b4abaf43 100644 --- a/awx_collection/plugins/modules/workflow_node_wait.py +++ b/awx_collection/plugins/modules/workflow_node_wait.py @@ -18,7 +18,7 @@ ANSIBLE_METADATA = { DOCUMENTATION = """ --- -module: tower_workflow_node_wait +module: workflow_node_wait author: "Sean Sullivan (@sean-m-sullivan)" short_description: Approve an approval node in a workflow job. description: @@ -52,13 +52,13 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = """ - name: Launch a workflow with a timeout of 10 seconds - tower_workflow_launch: + workflow_launch: workflow_template: "Test Workflow" wait: False register: workflow - name: Wait for a workflow node to finish - tower_workflow_node_wait: + workflow_node_wait: workflow_job_id: "{{ workflow.id }}" name: Approval Data Step timeout: 120 diff --git a/awx_collection/plugins/modules/workflow_template.py b/awx_collection/plugins/modules/workflow_template.py index 328823bd58..05654c377d 100644 --- a/awx_collection/plugins/modules/workflow_template.py +++ b/awx_collection/plugins/modules/workflow_template.py @@ -14,13 +14,13 @@ ANSIBLE_METADATA = {'status': ['deprecated'], 'supported_by': 'community', 'meta DOCUMENTATION = ''' --- -module: tower_workflow_template +module: workflow_template deprecated: removed_in: "14.0.0" why: Deprecated in favor of C(_workflow_job_template) and C(_workflow_job_template_node) modules. alternative: Use M(tower_workflow_job_template) and M(_workflow_job_template_node) instead. author: "Adrien Fleury (@fleu42)" -short_description: create, update, or destroy Ansible Tower workflow template. +short_description: create, update, or destroy Automation Controller workflow template. description: - A tower-cli based module for CRUD actions on workflow job templates. - Enables use of the old schema functionality. @@ -92,13 +92,13 @@ extends_documentation_fragment: awx.awx.auth_legacy EXAMPLES = ''' -- tower_workflow_template: +- workflow_template: name: Workflow Template description: My very first Workflow Template organization: My optional Organization schema: "{{ lookup('file', 'my_workflow.json') }}" -- tower_workflow_template: +- workflow_template: name: Workflow Template state: absent ''' diff --git a/awx_collection/requirements.txt b/awx_collection/requirements.txt index 37d1ffa1c6..4aa220003b 100644 --- a/awx_collection/requirements.txt +++ b/awx_collection/requirements.txt @@ -1,3 +1,3 @@ -pytz # for tower_schedule_rrule lookup plugin -python-dateutil>=2.7.0 # tower_schedule_rrule +pytz # for schedule_rrule lookup plugin +python-dateutil>=2.7.0 # schedule_rrule awxkit # For import and export modules \ No newline at end of file diff --git a/awx_collection/test/awx/test_ad_hoc_wait.py b/awx_collection/test/awx/test_ad_hoc_wait.py index 5718783015..c55b5e32b3 100644 --- a/awx_collection/test/awx/test_ad_hoc_wait.py +++ b/awx_collection/test/awx/test_ad_hoc_wait.py @@ -11,7 +11,7 @@ from awx.main.models.ad_hoc_commands import AdHocCommand @pytest.mark.django_db def test_ad_hoc_command_wait_successful(run_module, admin_user): command = AdHocCommand.objects.create(status='successful', started=now(), finished=now()) - result = run_module('tower_ad_hoc_command_wait', dict(command_id=command.id), admin_user) + result = run_module('ad_hoc_command_wait', dict(command_id=command.id), admin_user) result.pop('invocation', None) result['elapsed'] = float(result['elapsed']) assert result.pop('finished', '')[:10] == str(command.finished)[:10] @@ -22,7 +22,7 @@ def test_ad_hoc_command_wait_successful(run_module, admin_user): @pytest.mark.django_db def test_ad_hoc_command_wait_failed(run_module, admin_user): command = AdHocCommand.objects.create(status='failed', started=now(), finished=now()) - result = run_module('tower_ad_hoc_command_wait', dict(command_id=command.id), admin_user) + result = run_module('ad_hoc_command_wait', dict(command_id=command.id), admin_user) result.pop('invocation', None) result['elapsed'] = float(result['elapsed']) assert result.pop('finished', '')[:10] == str(command.finished)[:10] @@ -39,6 +39,6 @@ def test_ad_hoc_command_wait_failed(run_module, admin_user): @pytest.mark.django_db def test_ad_hoc_command_wait_not_found(run_module, admin_user): - result = run_module('tower_ad_hoc_command_wait', dict(command_id=42), admin_user) + result = run_module('ad_hoc_command_wait', dict(command_id=42), admin_user) result.pop('invocation', None) assert result == {"failed": True, "msg": "Unable to wait on ad hoc command 42; that ID does not exist in Tower."} diff --git a/awx_collection/test/awx/test_application.py b/awx_collection/test/awx/test_application.py index 8b924205b2..5ae51f5728 100644 --- a/awx_collection/test/awx/test_application.py +++ b/awx_collection/test/awx/test_application.py @@ -21,7 +21,7 @@ def test_create_application(run_module, admin_user): 'organization': 'foo', } - result = run_module('tower_application', module_args, admin_user) + result = run_module('application', module_args, admin_user) assert result.get('changed'), result application = OAuth2Application.objects.get(name='foo_app') diff --git a/awx_collection/test/awx/test_completeness.py b/awx_collection/test/awx/test_completeness.py index 05ffeb5d81..553c61b88a 100644 --- a/awx_collection/test/awx/test_completeness.py +++ b/awx_collection/test/awx/test_completeness.py @@ -16,7 +16,7 @@ import re # Normally a read-only endpoint should not have a module (i.e. /api/v2/me) but sometimes we reuse a name # For example, we have a tower_role module but /api/v2/roles is a read only endpoint. # This list indicates which read-only endpoints have associated modules with them. -read_only_endpoints_with_modules = ['tower_settings', 'tower_role', 'tower_project_update'] +read_only_endpoints_with_modules = ['settings', 'role', 'project_update'] # If a module should not be created for an endpoint and the endpoint is not read-only add it here # THINK HARD ABOUT DOING THIS @@ -24,23 +24,23 @@ no_module_for_endpoint = [] # Some modules work on the related fields of an endpoint. These modules will not have an auto-associated endpoint no_endpoint_for_module = [ - 'tower_import', - 'tower_meta', - 'tower_export', - 'tower_inventory_source_update', - 'tower_job_launch', - 'tower_job_wait', - 'tower_job_list', - 'tower_license', - 'tower_ping', - 'tower_receive', - 'tower_send', - 'tower_workflow_launch', - 'tower_workflow_node_wait', - 'tower_job_cancel', - 'tower_workflow_template', - 'tower_ad_hoc_command_wait', - 'tower_ad_hoc_command_cancel', + 'import', + 'meta', + 'export', + 'inventory_source_update', + 'job_launch', + 'job_wait', + 'job_list', + 'license', + 'ping', + 'receive', + 'send', + 'workflow_launch', + 'workflow_node_wait', + 'job_cancel', + 'workflow_template', + 'ad_hoc_command_wait', + 'ad_hoc_command_cancel', ] # Global module parameters we can ignore @@ -50,32 +50,32 @@ ignore_parameters = ['state', 'new_name', 'update_secrets', 'copy_from'] # Add the module name as the key with the value being the list of params to ignore no_api_parameter_ok = { # The wait is for whether or not to wait for a project update on change - 'tower_project': ['wait', 'interval', 'update_project'], + 'project': ['wait', 'interval', 'update_project'], # Existing_token and id are for working with an existing tokens - 'tower_token': ['existing_token', 'existing_token_id'], + 'token': ['existing_token', 'existing_token_id'], # /survey spec is now how we handle associations # We take an organization here to help with the lookups only - 'tower_job_template': ['survey_spec', 'organization'], - 'tower_inventory_source': ['organization'], + 'job_template': ['survey_spec', 'organization'], + 'inventory_source': ['organization'], # Organization is how we are looking up job templates, Approval node is for workflow_approval_templates - 'tower_workflow_job_template_node': ['organization', 'approval_node'], + 'workflow_job_template_node': ['organization', 'approval_node'], # Survey is how we handle associations - 'tower_workflow_job_template': ['survey_spec', 'destroy_current_schema'], + 'workflow_job_template': ['survey_spec', 'destroy_current_schema'], # ad hoc commands support interval and timeout since its more like tower_job_launch - 'tower_ad_hoc_command': ['interval', 'timeout', 'wait'], + 'ad_hoc_command': ['interval', 'timeout', 'wait'], # tower_group parameters to perserve hosts and children. - 'tower_group': ['preserve_existing_children', 'preserve_existing_hosts'], + 'group': ['preserve_existing_children', 'preserve_existing_hosts'], # tower_workflow_approval parameters that do not apply when approving an approval node. - 'tower_workflow_approval': ['action', 'interval', 'timeout', 'workflow_job_id'], + 'workflow_approval': ['action', 'interval', 'timeout', 'workflow_job_id'], } # When this tool was created we were not feature complete. Adding something in here indicates a module # that needs to be developed. If the module is found on the file system it will auto-detect that the # work is being done and will bypass this check. At some point this module should be removed from this list. -needs_development = ['tower_inventory_script'] +needs_development = ['inventory_script'] needs_param_development = { - 'tower_host': ['instance_id'], - 'tower_workflow_approval': ['description', 'execution_environment'], + 'host': ['instance_id'], + 'workflow_approval': ['description', 'execution_environment'], } # ----------------------------------------------------------------------------------------------------------- @@ -192,7 +192,7 @@ def test_completeness(collection_import, request, admin_user, job_template, exec singular_endpoint = singular_endpoint[:-3] if singular_endpoint != 'settings' and singular_endpoint.endswith('s'): singular_endpoint = singular_endpoint[:-1] - module_name = 'tower_{0}'.format(singular_endpoint) + module_name = '{0}'.format(singular_endpoint) endpoint_url = endpoint_response.data.get(endpoint) diff --git a/awx_collection/test/awx/test_credential.py b/awx_collection/test/awx/test_credential.py index 79e8560190..58d7c73394 100644 --- a/awx_collection/test/awx/test_credential.py +++ b/awx_collection/test/awx/test_credential.py @@ -29,7 +29,7 @@ def test_create_machine_credential(run_module, admin_user, organization, silence ct = CredentialType.defaults['ssh']() ct.save() # Example from docs - result = run_module('tower_credential', dict(name='Test Machine Credential', organization=organization.name, kind='ssh', state='present'), admin_user) + result = run_module('credential', dict(name='Test Machine Credential', organization=organization.name, kind='ssh', state='present'), admin_user) assert not result.get('failed', False), result.get('msg', result) assert result.get('changed'), result @@ -48,7 +48,7 @@ def test_create_vault_credential(run_module, admin_user, organization, silence_d ct.save() result = run_module( - 'tower_credential', + 'credential', dict(name='Test Vault Credential', organization=organization.name, kind='vault', vault_id='bar', vault_password='foobar', state='present'), admin_user, ) @@ -67,7 +67,7 @@ def test_create_vault_credential(run_module, admin_user, organization, silence_d @pytest.mark.django_db def test_ct_precedence_over_kind(run_module, admin_user, organization, cred_type, silence_deprecation): result = run_module( - 'tower_credential', dict(name='A credential', organization=organization.name, kind='ssh', credential_type=cred_type.name, state='present'), admin_user + 'credential', dict(name='A credential', organization=organization.name, kind='ssh', credential_type=cred_type.name, state='present'), admin_user ) assert not result.get('failed', False), result.get('msg', result) @@ -82,7 +82,7 @@ def test_input_overrides_old_fields(run_module, admin_user, organization, silenc ct = CredentialType.defaults['vault']() ct.save() result = run_module( - 'tower_credential', + 'credential', dict( name='A Vault credential', organization=organization.name, @@ -103,7 +103,7 @@ def test_input_overrides_old_fields(run_module, admin_user, organization, silenc @pytest.mark.django_db def test_missing_credential_type(run_module, admin_user, organization): Organization.objects.create(name='test-org') - result = run_module('tower_credential', dict(name='A credential', organization=organization.name, credential_type='foobar', state='present'), admin_user) + result = run_module('credential', dict(name='A credential', organization=organization.name, credential_type='foobar', state='present'), admin_user) assert result.get('failed', False), result assert 'credential_type' in result['msg'] assert 'foobar' in result['msg'] @@ -113,7 +113,7 @@ def test_missing_credential_type(run_module, admin_user, organization): @pytest.mark.django_db def test_make_use_of_custom_credential_type(run_module, organization, admin_user, cred_type): result = run_module( - 'tower_credential', + 'credential', dict(name='Galaxy Token for Steve', organization=organization.name, credential_type=cred_type.name, inputs={'token': '7rEZK38DJl58A7RxA6EC7lLvUHbBQ1'}), admin_user, ) @@ -137,7 +137,7 @@ def test_secret_field_write_twice(run_module, organization, admin_user, cred_typ val2 = '7rEZ238DJl5837rxA6xxxlLvUHbBQ1' for val in (val1, val2): result = run_module( - 'tower_credential', + 'credential', dict( name='Galaxy Token for Steve', organization=organization.name, diff --git a/awx_collection/test/awx/test_credential_input_source.py b/awx_collection/test/awx/test_credential_input_source.py index bb04535910..a38261d0af 100644 --- a/awx_collection/test/awx/test_credential_input_source.py +++ b/awx_collection/test/awx/test_credential_input_source.py @@ -29,7 +29,7 @@ def test_aim_credential_source(run_module, admin_user, organization, source_cred tgt_cred = Credential.objects.create(name='Test Machine Credential', organization=organization, credential_type=ct, inputs={'username': 'bob'}) result = run_module( - 'tower_credential_input_source', + 'credential_input_source', dict( source_credential=source_cred_aim.name, target_credential=tgt_cred.name, @@ -73,7 +73,7 @@ def test_conjur_credential_source(run_module, admin_user, organization, source_c tgt_cred = Credential.objects.create(name='Test Machine Credential', organization=organization, credential_type=ct, inputs={'username': 'bob'}) result = run_module( - 'tower_credential_input_source', + 'credential_input_source', dict( source_credential=source_cred_conjur.name, target_credential=tgt_cred.name, @@ -123,7 +123,7 @@ def test_hashi_secret_credential_source(run_module, admin_user, organization, so tgt_cred = Credential.objects.create(name='Test Machine Credential', organization=organization, credential_type=ct, inputs={'username': 'bob'}) result = run_module( - 'tower_credential_input_source', + 'credential_input_source', dict( source_credential=source_cred_hashi_secret.name, target_credential=tgt_cred.name, @@ -170,7 +170,7 @@ def test_hashi_ssh_credential_source(run_module, admin_user, organization, sourc tgt_cred = Credential.objects.create(name='Test Machine Credential', organization=organization, credential_type=ct, inputs={'username': 'bob'}) result = run_module( - 'tower_credential_input_source', + 'credential_input_source', dict( source_credential=source_cred_hashi_ssh.name, target_credential=tgt_cred.name, @@ -224,7 +224,7 @@ def test_azure_kv_credential_source(run_module, admin_user, organization, source tgt_cred = Credential.objects.create(name='Test Machine Credential', organization=organization, credential_type=ct, inputs={'username': 'bob'}) result = run_module( - 'tower_credential_input_source', + 'credential_input_source', dict( source_credential=source_cred_azure_kv.name, target_credential=tgt_cred.name, @@ -265,7 +265,7 @@ def test_aim_credential_source(run_module, admin_user, organization, source_cred tgt_cred = Credential.objects.create(name='Test Machine Credential', organization=organization, credential_type=ct, inputs={'username': 'bob'}) result = run_module( - 'tower_credential_input_source', + 'credential_input_source', dict( source_credential=source_cred_aim.name, target_credential=tgt_cred.name, @@ -280,7 +280,7 @@ def test_aim_credential_source(run_module, admin_user, organization, source_cred assert result.get('changed'), result unchangedResult = run_module( - 'tower_credential_input_source', + 'credential_input_source', dict( source_credential=source_cred_aim.name, target_credential=tgt_cred.name, @@ -295,7 +295,7 @@ def test_aim_credential_source(run_module, admin_user, organization, source_cred assert not unchangedResult.get('changed'), result changedResult = run_module( - 'tower_credential_input_source', + 'credential_input_source', dict(source_credential=source_cred_aim_alt.name, target_credential=tgt_cred.name, input_field_name='password', state='present'), admin_user, ) @@ -336,7 +336,7 @@ def test_centrify_vault_credential_source(run_module, admin_user, organization, tgt_cred = Credential.objects.create(name='Test Machine Credential', organization=organization, credential_type=ct, inputs={'username': 'bob'}) result = run_module( - 'tower_credential_input_source', + 'credential_input_source', dict( source_credential=source_cred_centrify_secret.name, target_credential=tgt_cred.name, diff --git a/awx_collection/test/awx/test_credential_type.py b/awx_collection/test/awx/test_credential_type.py index 8afc92a1e9..4a0f25aa30 100644 --- a/awx_collection/test/awx/test_credential_type.py +++ b/awx_collection/test/awx/test_credential_type.py @@ -11,7 +11,7 @@ from awx.main.models import CredentialType def test_create_custom_credential_type(run_module, admin_user, silence_deprecation): # Example from docs result = run_module( - 'tower_credential_type', + 'credential_type', dict( name='Nexus', description='Credentials type for Nexus', @@ -37,7 +37,7 @@ def test_create_custom_credential_type(run_module, admin_user, silence_deprecati @pytest.mark.django_db def test_changed_false_with_api_changes(run_module, admin_user): result = run_module( - 'tower_credential_type', + 'credential_type', dict( name='foo', kind='cloud', @@ -50,7 +50,7 @@ def test_changed_false_with_api_changes(run_module, admin_user): assert result.get('changed'), result result = run_module( - 'tower_credential_type', + 'credential_type', dict( name='foo', inputs={"fields": [{"id": "env_value", "label": "foo", "default": "foo"}]}, diff --git a/awx_collection/test/awx/test_group.py b/awx_collection/test/awx/test_group.py index e7aeaeb0d6..295a72cabd 100644 --- a/awx_collection/test/awx/test_group.py +++ b/awx_collection/test/awx/test_group.py @@ -13,7 +13,7 @@ def test_create_group(run_module, admin_user): inv = Inventory.objects.create(name='test-inv', organization=org) variables = {"ansible_network_os": "iosxr"} - result = run_module('tower_group', dict(name='Test Group', inventory='test-inv', variables=variables, state='present'), admin_user) + result = run_module('group', dict(name='Test Group', inventory='test-inv', variables=variables, state='present'), admin_user) assert result.get('changed'), result group = Group.objects.get(name='Test Group') @@ -39,7 +39,7 @@ def test_associate_hosts_and_children(run_module, admin_user, organization): child = Group.objects.create(inventory=inv, name='child_group') result = run_module( - 'tower_group', + 'group', dict(name='Test Group', inventory='test-inv', hosts=[inv_hosts[1].name, inv_hosts[2].name], children=[child.name], state='present'), admin_user, ) @@ -56,7 +56,7 @@ def test_associate_on_create(run_module, admin_user, organization): child = Group.objects.create(name='test-child', inventory=inv) host = Host.objects.create(name='test-host', inventory=inv) - result = run_module('tower_group', dict(name='Test Group', inventory='test-inv', hosts=[host.name], groups=[child.name], state='present'), admin_user) + result = run_module('group', dict(name='Test Group', inventory='test-inv', hosts=[host.name], groups=[child.name], state='present'), admin_user) assert not result.get('failed', False), result.get('msg', result) assert result['changed'] is True @@ -70,7 +70,7 @@ def test_children_alias_of_groups(run_module, admin_user, organization): inv = Inventory.objects.create(name='test-inv', organization=organization) group = Group.objects.create(name='Test Group', inventory=inv) child = Group.objects.create(inventory=inv, name='child_group') - result = run_module('tower_group', dict(name='Test Group', inventory='test-inv', groups=[child.name], state='present'), admin_user) + result = run_module('group', dict(name='Test Group', inventory='test-inv', groups=[child.name], state='present'), admin_user) assert not result.get('failed', False), result.get('msg', result) assert result['changed'] is True @@ -87,7 +87,7 @@ def test_tower_group_idempotent(run_module, admin_user): inventory=inv, ) - result = run_module('tower_group', dict(name='Test Group', inventory='test-inv', state='present'), admin_user) + result = run_module('group', dict(name='Test Group', inventory='test-inv', state='present'), admin_user) result.pop('invocation') assert result == { diff --git a/awx_collection/test/awx/test_instance_group.py b/awx_collection/test/awx/test_instance_group.py index eb06261c99..7372591b09 100644 --- a/awx_collection/test/awx/test_instance_group.py +++ b/awx_collection/test/awx/test_instance_group.py @@ -11,7 +11,7 @@ from awx.main.tests.functional.conftest import kube_credential, credentialtype_k @pytest.mark.django_db def test_instance_group_create(run_module, admin_user): result = run_module( - 'tower_instance_group', {'name': 'foo-group', 'policy_instance_percentage': 34, 'policy_instance_minimum': 12, 'state': 'present'}, admin_user + 'instance_group', {'name': 'foo-group', 'policy_instance_percentage': 34, 'policy_instance_minimum': 12, 'state': 'present'}, admin_user ) assert not result.get('failed', False), result assert result['changed'] @@ -24,7 +24,7 @@ def test_instance_group_create(run_module, admin_user): new_instance = Instance.objects.create(hostname='foo.example.com') # Set the new instance group only to the one instnace - result = run_module('tower_instance_group', {'name': 'foo-group', 'instances': [new_instance.hostname], 'state': 'present'}, admin_user) + result = run_module('instance_group', {'name': 'foo-group', 'instances': [new_instance.hostname], 'state': 'present'}, admin_user) assert not result.get('failed', False), result assert result['changed'] @@ -41,9 +41,7 @@ def test_instance_group_create(run_module, admin_user): def test_container_group_create(run_module, admin_user, kube_credential): pod_spec = "{ 'Nothing': True }" - result = run_module( - 'tower_instance_group', {'name': 'foo-c-group', 'credential': kube_credential.id, 'is_container_group': True, 'state': 'present'}, admin_user - ) + result = run_module('instance_group', {'name': 'foo-c-group', 'credential': kube_credential.id, 'is_container_group': True, 'state': 'present'}, admin_user) assert not result.get('failed', False), result['msg'] assert result['changed'] @@ -51,7 +49,7 @@ def test_container_group_create(run_module, admin_user, kube_credential): assert ig.pod_spec_override == '' result = run_module( - 'tower_instance_group', + 'instance_group', {'name': 'foo-c-group', 'credential': kube_credential.id, 'is_container_group': True, 'pod_spec_override': pod_spec, 'state': 'present'}, admin_user, ) diff --git a/awx_collection/test/awx/test_inventory.py b/awx_collection/test/awx/test_inventory.py index d2e9d7e39f..aa42fdbfc0 100644 --- a/awx_collection/test/awx/test_inventory.py +++ b/awx_collection/test/awx/test_inventory.py @@ -13,7 +13,7 @@ def test_inventory_create(run_module, admin_user, organization, insights_credent # Create an insights credential result = run_module( - 'tower_inventory', + 'inventory', { 'name': 'foo-inventory', 'organization': organization.name, @@ -39,7 +39,7 @@ def test_inventory_create(run_module, admin_user, organization, insights_credent @pytest.mark.django_db def test_invalid_smart_inventory_create(run_module, admin_user, organization): result = run_module( - 'tower_inventory', + 'inventory', {'name': 'foo-inventory', 'organization': organization.name, 'kind': 'smart', 'host_filter': 'ansible', 'state': 'present'}, admin_user, ) @@ -51,7 +51,7 @@ def test_invalid_smart_inventory_create(run_module, admin_user, organization): @pytest.mark.django_db def test_valid_smart_inventory_create(run_module, admin_user, organization): result = run_module( - 'tower_inventory', + 'inventory', {'name': 'foo-inventory', 'organization': organization.name, 'kind': 'smart', 'host_filter': 'name=my_host', 'state': 'present'}, admin_user, ) diff --git a/awx_collection/test/awx/test_inventory_source.py b/awx_collection/test/awx/test_inventory_source.py index 53aac994b7..bebd3fc00b 100644 --- a/awx_collection/test/awx/test_inventory_source.py +++ b/awx_collection/test/awx/test_inventory_source.py @@ -28,7 +28,7 @@ def project(base_inventory): def test_inventory_source_create(run_module, admin_user, base_inventory, project): source_path = '/var/lib/awx/example_source_path/' result = run_module( - 'tower_inventory_source', + 'inventory_source', dict(name='foo', inventory=base_inventory.name, state='present', source='scm', source_path=source_path, source_project=project.name), admin_user, ) @@ -49,7 +49,7 @@ def test_create_inventory_source_implied_org(run_module, admin_user): inv = Inventory.objects.create(name='test-inv', organization=org) # Credential is not required for ec2 source, because of IAM roles - result = run_module('tower_inventory_source', dict(name='Test Inventory Source', inventory='test-inv', source='ec2', state='present'), admin_user) + result = run_module('inventory_source', dict(name='Test Inventory Source', inventory='test-inv', source='ec2', state='present'), admin_user) assert result.pop('changed', None), result inv_src = InventorySource.objects.get(name='Test Inventory Source') @@ -72,7 +72,7 @@ def test_create_inventory_source_multiple_orgs(run_module, admin_user): inv2 = Inventory.objects.create(name='test-inv', organization=org2) result = run_module( - 'tower_inventory_source', + 'inventory_source', dict(name='Test Inventory Source', inventory=inv2.name, organization='test-org-number-two', source='ec2', state='present'), admin_user, ) @@ -90,14 +90,14 @@ def test_create_inventory_source_multiple_orgs(run_module, admin_user): @pytest.mark.django_db def test_falsy_value(run_module, admin_user, base_inventory): - result = run_module('tower_inventory_source', dict(name='falsy-test', inventory=base_inventory.name, source='ec2', update_on_launch=True), admin_user) + result = run_module('inventory_source', dict(name='falsy-test', inventory=base_inventory.name, source='ec2', update_on_launch=True), admin_user) assert not result.get('failed', False), result.get('msg', result) assert result.get('changed', None), result inv_src = InventorySource.objects.get(name='falsy-test') assert inv_src.update_on_launch is True - result = run_module('tower_inventory_source', dict(name='falsy-test', inventory=base_inventory.name, source='ec2', update_on_launch=False), admin_user) + result = run_module('inventory_source', dict(name='falsy-test', inventory=base_inventory.name, source='ec2', update_on_launch=False), admin_user) inv_src.refresh_from_db() assert inv_src.update_on_launch is False @@ -127,7 +127,7 @@ def test_falsy_value(run_module, admin_user, base_inventory): @pytest.mark.django_db def test_missing_required_credential(run_module, admin_user, base_inventory): - result = run_module('tower_inventory_source', dict(name='Test Azure Source', inventory=base_inventory.name, source='azure_rm', state='present'), admin_user) + result = run_module('inventory_source', dict(name='Test Azure Source', inventory=base_inventory.name, source='azure_rm', state='present'), admin_user) assert result.pop('failed', None) is True, result assert 'Credential is required for a cloud source' in result.get('msg', '') @@ -136,7 +136,7 @@ def test_missing_required_credential(run_module, admin_user, base_inventory): @pytest.mark.django_db def test_source_project_not_for_cloud(run_module, admin_user, base_inventory, project): result = run_module( - 'tower_inventory_source', + 'inventory_source', dict(name='Test ec2 Inventory Source', inventory=base_inventory.name, source='ec2', state='present', source_project=project.name), admin_user, ) @@ -148,7 +148,7 @@ def test_source_project_not_for_cloud(run_module, admin_user, base_inventory, pr @pytest.mark.django_db def test_source_path_not_for_cloud(run_module, admin_user, base_inventory): result = run_module( - 'tower_inventory_source', + 'inventory_source', dict(name='Test ec2 Inventory Source', inventory=base_inventory.name, source='ec2', state='present', source_path='where/am/I'), admin_user, ) @@ -160,7 +160,7 @@ def test_source_path_not_for_cloud(run_module, admin_user, base_inventory): @pytest.mark.django_db def test_scm_source_needs_project(run_module, admin_user, base_inventory): result = run_module( - 'tower_inventory_source', + 'inventory_source', dict( name='SCM inventory without project', inventory=base_inventory.name, state='present', source='scm', source_path='/var/lib/awx/example_source_path/' ), diff --git a/awx_collection/test/awx/test_job.py b/awx_collection/test/awx/test_job.py index 107d7c1616..3d25353e9b 100644 --- a/awx_collection/test/awx/test_job.py +++ b/awx_collection/test/awx/test_job.py @@ -11,7 +11,7 @@ from awx.main.models import Job @pytest.mark.django_db def test_job_wait_successful(run_module, admin_user): job = Job.objects.create(status='successful', started=now(), finished=now()) - result = run_module('tower_job_wait', dict(job_id=job.id), admin_user) + result = run_module('job_wait', dict(job_id=job.id), admin_user) result.pop('invocation', None) result['elapsed'] = float(result['elapsed']) assert result.pop('finished', '')[:10] == str(job.finished)[:10] @@ -22,7 +22,7 @@ def test_job_wait_successful(run_module, admin_user): @pytest.mark.django_db def test_job_wait_failed(run_module, admin_user): job = Job.objects.create(status='failed', started=now(), finished=now()) - result = run_module('tower_job_wait', dict(job_id=job.id), admin_user) + result = run_module('job_wait', dict(job_id=job.id), admin_user) result.pop('invocation', None) result['elapsed'] = float(result['elapsed']) assert result.pop('finished', '')[:10] == str(job.finished)[:10] @@ -32,6 +32,6 @@ def test_job_wait_failed(run_module, admin_user): @pytest.mark.django_db def test_job_wait_not_found(run_module, admin_user): - result = run_module('tower_job_wait', dict(job_id=42), admin_user) + result = run_module('job_wait', dict(job_id=42), admin_user) result.pop('invocation', None) assert result == {"failed": True, "msg": "Unable to wait on job 42; that ID does not exist in Tower."} diff --git a/awx_collection/test/awx/test_job_template.py b/awx_collection/test/awx/test_job_template.py index 60c8f9066f..97330a5fb5 100644 --- a/awx_collection/test/awx/test_job_template.py +++ b/awx_collection/test/awx/test_job_template.py @@ -20,7 +20,7 @@ def test_create_job_template(run_module, admin_user, project, inventory): 'state': 'present', } - result = run_module('tower_job_template', module_args, admin_user) + result = run_module('job_template', module_args, admin_user) jt = JobTemplate.objects.get(name='foo') assert jt.extra_vars == '{"foo": "bar"}' @@ -48,7 +48,7 @@ def test_resets_job_template_values(run_module, admin_user, project, inventory): 'ask_limit_on_launch': True, } - result = run_module('tower_job_template', module_args, admin_user) + result = run_module('job_template', module_args, admin_user) jt = JobTemplate.objects.get(name='foo') assert jt.forks == 20 @@ -70,7 +70,7 @@ def test_resets_job_template_values(run_module, admin_user, project, inventory): 'ask_limit_on_launch': False, } - result = run_module('tower_job_template', module_args, admin_user) + result = run_module('job_template', module_args, admin_user) assert result['changed'] jt = JobTemplate.objects.get(name='foo') @@ -92,7 +92,7 @@ def test_job_launch_with_prompting(run_module, admin_user, project, organization ask_credential_on_launch=True, ) result = run_module( - 'tower_job_launch', + 'job_launch', dict( job_template='foo', inventory=inventory.name, @@ -112,7 +112,7 @@ def test_job_launch_with_prompting(run_module, admin_user, project, organization @pytest.mark.django_db def test_job_template_with_new_credentials(run_module, admin_user, project, inventory, machine_credential, vault_credential): result = run_module( - 'tower_job_template', + 'job_template', dict( name='foo', playbook='helloworld.yml', project=project.name, inventory=inventory.name, credentials=[machine_credential.name, vault_credential.name] ), @@ -126,7 +126,7 @@ def test_job_template_with_new_credentials(run_module, admin_user, project, inve prior_ct = ActivityStream.objects.count() result = run_module( - 'tower_job_template', + 'job_template', dict( name='foo', playbook='helloworld.yml', project=project.name, inventory=inventory.name, credentials=[machine_credential.name, vault_credential.name] ), @@ -144,7 +144,7 @@ def test_job_template_with_new_credentials(run_module, admin_user, project, inve @pytest.mark.django_db def test_job_template_with_survey_spec(run_module, admin_user, project, inventory, survey_spec): result = run_module( - 'tower_job_template', + 'job_template', dict(name='foo', playbook='helloworld.yml', project=project.name, inventory=inventory.name, survey_spec=survey_spec, survey_enabled=True), admin_user, ) @@ -156,7 +156,7 @@ def test_job_template_with_survey_spec(run_module, admin_user, project, inventor prior_ct = ActivityStream.objects.count() result = run_module( - 'tower_job_template', + 'job_template', dict(name='foo', playbook='helloworld.yml', project=project.name, inventory=inventory.name, survey_spec=survey_spec, survey_enabled=True), admin_user, ) @@ -172,7 +172,7 @@ def test_job_template_with_survey_spec(run_module, admin_user, project, inventor @pytest.mark.django_db def test_job_template_with_wrong_survey_spec(run_module, admin_user, project, inventory, survey_spec): result = run_module( - 'tower_job_template', + 'job_template', dict(name='foo', playbook='helloworld.yml', project=project.name, inventory=inventory.name, survey_spec=survey_spec, survey_enabled=True), admin_user, ) @@ -187,7 +187,7 @@ def test_job_template_with_wrong_survey_spec(run_module, admin_user, project, in del survey_spec['description'] result = run_module( - 'tower_job_template', + 'job_template', dict(name='foo', playbook='helloworld.yml', project=project.name, inventory=inventory.name, survey_spec=survey_spec, survey_enabled=True), admin_user, ) @@ -204,7 +204,7 @@ def test_job_template_with_survey_encrypted_default(run_module, admin_user, proj } for i in range(2): result = run_module( - 'tower_job_template', + 'job_template', dict(name='foo', playbook='helloworld.yml', project=project.name, inventory=inventory.name, survey_spec=spec, survey_enabled=True), admin_user, ) @@ -236,9 +236,7 @@ def test_associate_only_on_success(run_module, admin_user, organization, project jt.notification_templates_error.add(nt1) # test preservation of error NTs when success NTs are added - result = run_module( - 'tower_job_template', dict(name='foo', playbook='helloworld.yml', project=project.name, notification_templates_success=['nt2']), admin_user - ) + result = run_module('job_template', dict(name='foo', playbook='helloworld.yml', project=project.name, notification_templates_success=['nt2']), admin_user) assert not result.get('failed', False), result.get('msg', result) assert result.get('changed', True), result @@ -246,7 +244,7 @@ def test_associate_only_on_success(run_module, admin_user, organization, project assert list(jt.notification_templates_error.values_list('id', flat=True)) == [nt1.id] # test removal to empty list - result = run_module('tower_job_template', dict(name='foo', playbook='helloworld.yml', project=project.name, notification_templates_success=[]), admin_user) + result = run_module('job_template', dict(name='foo', playbook='helloworld.yml', project=project.name, notification_templates_success=[]), admin_user) assert not result.get('failed', False), result.get('msg', result) assert result.get('changed', True), result diff --git a/awx_collection/test/awx/test_label.py b/awx_collection/test/awx/test_label.py index 9797c66323..2a34ceb92d 100644 --- a/awx_collection/test/awx/test_label.py +++ b/awx_collection/test/awx/test_label.py @@ -9,7 +9,7 @@ from awx.main.models import Label @pytest.mark.django_db def test_create_label(run_module, admin_user, organization): - result = run_module('tower_label', dict(name='test-label', organization=organization.name), admin_user) + result = run_module('label', dict(name='test-label', organization=organization.name), admin_user) assert not result.get('failed'), result.get('msg', result) assert result.get('changed', False) @@ -18,7 +18,7 @@ def test_create_label(run_module, admin_user, organization): @pytest.mark.django_db def test_create_label_using_org_id(run_module, admin_user, organization): - result = run_module('tower_label', dict(name='test-label', organization=organization.id), admin_user) + result = run_module('label', dict(name='test-label', organization=organization.id), admin_user) assert not result.get('failed'), result.get('msg', result) assert result.get('changed', False) @@ -29,7 +29,7 @@ def test_create_label_using_org_id(run_module, admin_user, organization): def test_modify_label(run_module, admin_user, organization): label = Label.objects.create(name='test-label', organization=organization) - result = run_module('tower_label', dict(name='test-label', new_name='renamed-label', organization=organization.name), admin_user) + result = run_module('label', dict(name='test-label', new_name='renamed-label', organization=organization.name), admin_user) assert not result.get('failed'), result.get('msg', result) assert result.get('changed', False) diff --git a/awx_collection/test/awx/test_module_utils.py b/awx_collection/test/awx/test_module_utils.py index 71c03bd7e6..c80c526635 100644 --- a/awx_collection/test/awx/test_module_utils.py +++ b/awx_collection/test/awx/test_module_utils.py @@ -49,12 +49,12 @@ def mock_awx_ping_response(self, method, url, **kwargs): def test_version_warning(collection_import, silence_warning): - TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule + ControllerAPIModule = collection_import('plugins.module_utils.controller_api').ControllerAPIModule cli_data = {'ANSIBLE_MODULE_ARGS': {}} testargs = ['module_file2.py', json.dumps(cli_data)] with mock.patch.object(sys, 'argv', testargs): with mock.patch('ansible.module_utils.urls.Request.open', new=mock_awx_ping_response): - my_module = TowerAPIModule(argument_spec=dict()) + my_module = ControllerAPIModule(argument_spec=dict()) my_module._COLLECTION_VERSION = "2.0.0" my_module._COLLECTION_TYPE = "awx" my_module.get_endpoint('ping') @@ -64,13 +64,13 @@ def test_version_warning(collection_import, silence_warning): def test_version_warning_strictness_awx(collection_import, silence_warning): - TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule + ControllerAPIModule = collection_import('plugins.module_utils.controller_api').ControllerAPIModule cli_data = {'ANSIBLE_MODULE_ARGS': {}} testargs = ['module_file2.py', json.dumps(cli_data)] # Compare 1.0.0 to 1.2.3 (major matches) with mock.patch.object(sys, 'argv', testargs): with mock.patch('ansible.module_utils.urls.Request.open', new=mock_awx_ping_response): - my_module = TowerAPIModule(argument_spec=dict()) + my_module = ControllerAPIModule(argument_spec=dict()) my_module._COLLECTION_VERSION = "1.0.0" my_module._COLLECTION_TYPE = "awx" my_module.get_endpoint('ping') @@ -79,7 +79,7 @@ def test_version_warning_strictness_awx(collection_import, silence_warning): # Compare 1.2.0 to 1.2.3 (major matches minor does not count) with mock.patch.object(sys, 'argv', testargs): with mock.patch('ansible.module_utils.urls.Request.open', new=mock_awx_ping_response): - my_module = TowerAPIModule(argument_spec=dict()) + my_module = ControllerAPIModule(argument_spec=dict()) my_module._COLLECTION_VERSION = "1.2.0" my_module._COLLECTION_TYPE = "awx" my_module.get_endpoint('ping') @@ -87,13 +87,13 @@ def test_version_warning_strictness_awx(collection_import, silence_warning): def test_version_warning_strictness_tower(collection_import, silence_warning): - TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule + ControllerAPIModule = collection_import('plugins.module_utils.controller_api').ControllerAPIModule cli_data = {'ANSIBLE_MODULE_ARGS': {}} testargs = ['module_file2.py', json.dumps(cli_data)] # Compare 1.2.0 to 1.2.3 (major/minor matches) with mock.patch.object(sys, 'argv', testargs): with mock.patch('ansible.module_utils.urls.Request.open', new=mock_tower_ping_response): - my_module = TowerAPIModule(argument_spec=dict()) + my_module = ControllerAPIModule(argument_spec=dict()) my_module._COLLECTION_VERSION = "1.2.0" my_module._COLLECTION_TYPE = "tower" my_module.get_endpoint('ping') @@ -102,7 +102,7 @@ def test_version_warning_strictness_tower(collection_import, silence_warning): # Compare 1.0.0 to 1.2.3 (major/minor fail to match) with mock.patch.object(sys, 'argv', testargs): with mock.patch('ansible.module_utils.urls.Request.open', new=mock_tower_ping_response): - my_module = TowerAPIModule(argument_spec=dict()) + my_module = ControllerAPIModule(argument_spec=dict()) my_module._COLLECTION_VERSION = "1.0.0" my_module._COLLECTION_TYPE = "tower" my_module.get_endpoint('ping') @@ -112,12 +112,12 @@ def test_version_warning_strictness_tower(collection_import, silence_warning): def test_type_warning(collection_import, silence_warning): - TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule + ControllerAPIModule = collection_import('plugins.module_utils.controller_api').ControllerAPIModule cli_data = {'ANSIBLE_MODULE_ARGS': {}} testargs = ['module_file2.py', json.dumps(cli_data)] with mock.patch.object(sys, 'argv', testargs): with mock.patch('ansible.module_utils.urls.Request.open', new=mock_awx_ping_response): - my_module = TowerAPIModule(argument_spec={}) + my_module = ControllerAPIModule(argument_spec={}) my_module._COLLECTION_VERSION = ping_version my_module._COLLECTION_TYPE = "tower" my_module.get_endpoint('ping') @@ -128,15 +128,15 @@ def test_type_warning(collection_import, silence_warning): def test_duplicate_config(collection_import, silence_warning): # imports done here because of PATH issues unique to this test suite - TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule + ControllerAPIModule = collection_import('plugins.module_utils.controller_api').ControllerAPIModule data = {'name': 'zigzoom', 'zig': 'zoom', 'tower_username': 'bob', 'tower_config_file': 'my_config'} - with mock.patch.object(TowerAPIModule, 'load_config') as mock_load: + with mock.patch.object(ControllerAPIModule, 'load_config') as mock_load: argument_spec = dict( name=dict(required=True), zig=dict(type='str'), ) - TowerAPIModule(argument_spec=argument_spec, direct_params=data) + ControllerAPIModule(argument_spec=argument_spec, direct_params=data) assert mock_load.mock_calls[-1] == mock.call('my_config') silence_warning.assert_called_once_with( @@ -152,11 +152,11 @@ def test_no_templated_values(collection_import): Those replacements should happen at build time, so they should not be checked into source. """ - TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule - assert TowerAPIModule._COLLECTION_VERSION == "0.0.1-devel", ( + ControllerAPIModule = collection_import('plugins.module_utils.controller_api').ControllerAPIModule + assert ControllerAPIModule._COLLECTION_VERSION == "0.0.1-devel", ( 'The collection version is templated when the collection is built ' 'and the code should retain the placeholder of "0.0.1-devel".' ) - InventoryModule = collection_import('plugins.inventory.tower').InventoryModule + InventoryModule = collection_import('plugins.inventory.controller').InventoryModule assert InventoryModule.NAME == 'awx.awx.tower', ( 'The inventory plugin FQCN is templated when the collection is built ' 'and the code should retain the default of awx.awx.' ) @@ -172,7 +172,7 @@ def test_conflicting_name_and_id(run_module, admin_user): org_by_id = Organization.objects.create(name='foo') slug = str(org_by_id.id) org_by_name = Organization.objects.create(name=slug) - result = run_module('tower_team', {'name': 'foo_team', 'description': 'fooin around', 'organization': slug}, admin_user) + result = run_module('team', {'name': 'foo_team', 'description': 'fooin around', 'organization': slug}, admin_user) assert not result.get('failed', False), result.get('msg', result) team = Team.objects.filter(name='foo_team').first() assert str(team.organization_id) == slug, 'Lookup by id should be preferenced over name in cases of conflict.' @@ -195,9 +195,7 @@ def test_multiple_lookup(run_module, admin_user): scm_type='git', scm_url="https://github.com/ansible/ansible-tower-samples", ) - result = run_module( - 'tower_job_template', {'name': 'Demo Job Template', 'project': proj1.name, 'inventory': inv.id, 'playbook': 'hello_world.yml'}, admin_user - ) + result = run_module('job_template', {'name': 'Demo Job Template', 'project': proj1.name, 'inventory': inv.id, 'playbook': 'hello_world.yml'}, admin_user) assert result.get('failed', False) assert 'projects' in result['msg'] assert 'foo' in result['msg'] diff --git a/awx_collection/test/awx/test_notification_template.py b/awx_collection/test/awx/test_notification_template.py index cc3ca6518e..8bd2647b02 100644 --- a/awx_collection/test/awx/test_notification_template.py +++ b/awx_collection/test/awx/test_notification_template.py @@ -35,7 +35,7 @@ def test_create_modify_notification_template(run_module, admin_user, organizatio 'timeout': 4, } result = run_module( - 'tower_notification_template', + 'notification_template', dict( name='foo-notification-template', organization=organization.name, @@ -54,7 +54,7 @@ def test_create_modify_notification_template(run_module, admin_user, organizatio # Test no-op, this is impossible if the notification_configuration is given # because we cannot determine if password fields changed result = run_module( - 'tower_notification_template', + 'notification_template', dict( name='foo-notification-template', organization=organization.name, @@ -68,7 +68,7 @@ def test_create_modify_notification_template(run_module, admin_user, organizatio # Test a change in the configuration nt_config['timeout'] = 12 result = run_module( - 'tower_notification_template', + 'notification_template', dict( name='foo-notification-template', organization=organization.name, @@ -87,7 +87,7 @@ def test_create_modify_notification_template(run_module, admin_user, organizatio @pytest.mark.django_db def test_invalid_notification_configuration(run_module, admin_user, organization): result = run_module( - 'tower_notification_template', + 'notification_template', dict( name='foo-notification-template', organization=organization.name, @@ -104,7 +104,7 @@ def test_invalid_notification_configuration(run_module, admin_user, organization def test_deprecated_to_modern_no_op(run_module, admin_user, organization): nt_config = {'url': 'http://www.example.com/hook', 'headers': {'X-Custom-Header': 'value123'}} result = run_module( - 'tower_notification_template', + 'notification_template', dict( name='foo-notification-template', organization=organization.name, @@ -117,7 +117,7 @@ def test_deprecated_to_modern_no_op(run_module, admin_user, organization): assert result.pop('changed', None), result result = run_module( - 'tower_notification_template', + 'notification_template', dict( name='foo-notification-template', organization=organization.name, @@ -142,7 +142,7 @@ def test_build_notification_message_undefined(run_module, admin_user, organizati custom_start_template = {'body': '{"started_by": "{{ job.summary_fields.created_by.username | default(\'My Placeholder\') }}"}'} messages = {'started': custom_start_template, 'success': None, 'error': None, 'workflow_approval': None} result = run_module( - 'tower_notification_template', + 'notification_template', dict( name='foo-notification-template', organization=organization.name, diff --git a/awx_collection/test/awx/test_organization.py b/awx_collection/test/awx/test_organization.py index 8777b8c309..a3f3a724e1 100644 --- a/awx_collection/test/awx/test_organization.py +++ b/awx_collection/test/awx/test_organization.py @@ -23,7 +23,7 @@ def test_create_organization(run_module, admin_user): 'tower_config_file': None, } - result = run_module('tower_organization', module_args, admin_user) + result = run_module('organization', module_args, admin_user) assert result.get('changed'), result org = Organization.objects.get(name='foo') diff --git a/awx_collection/test/awx/test_project.py b/awx_collection/test/awx/test_project.py index 43046a8564..ed49754800 100644 --- a/awx_collection/test/awx/test_project.py +++ b/awx_collection/test/awx/test_project.py @@ -10,7 +10,7 @@ from awx.main.models import Project @pytest.mark.django_db def test_create_project(run_module, admin_user, organization, silence_warning): result = run_module( - 'tower_project', + 'project', dict(name='foo', organization=organization.name, scm_type='git', scm_url='https://foo.invalid', wait=False, scm_update_cache_timeout=5), admin_user, ) diff --git a/awx_collection/test/awx/test_role.py b/awx_collection/test/awx/test_role.py index 5580c6b577..f5cc5ceec1 100644 --- a/awx_collection/test/awx/test_role.py +++ b/awx_collection/test/awx/test_role.py @@ -14,7 +14,7 @@ def test_grant_organization_permission(run_module, admin_user, organization, sta if state == 'absent': organization.admin_role.members.add(rando) - result = run_module('tower_role', {'user': rando.username, 'organization': organization.name, 'role': 'admin', 'state': state}, admin_user) + result = run_module('role', {'user': rando.username, 'organization': organization.name, 'role': 'admin', 'state': state}, admin_user) assert not result.get('failed', False), result.get('msg', result) if state == 'present': @@ -31,7 +31,7 @@ def test_grant_workflow_permission(run_module, admin_user, organization, state): if state == 'absent': wfjt.execute_role.members.add(rando) - result = run_module('tower_role', {'user': rando.username, 'workflow': wfjt.name, 'role': 'execute', 'state': state}, admin_user) + result = run_module('role', {'user': rando.username, 'workflow': wfjt.name, 'role': 'execute', 'state': state}, admin_user) assert not result.get('failed', False), result.get('msg', result) if state == 'present': @@ -49,7 +49,7 @@ def test_grant_workflow_list_permission(run_module, admin_user, organization, st wfjt.execute_role.members.add(rando) result = run_module( - 'tower_role', + 'role', {'user': rando.username, 'lookup_organization': wfjt.organization.name, 'workflows': [wfjt.name], 'role': 'execute', 'state': state}, admin_user, ) @@ -69,7 +69,7 @@ def test_grant_workflow_approval_permission(run_module, admin_user, organization if state == 'absent': wfjt.execute_role.members.add(rando) - result = run_module('tower_role', {'user': rando.username, 'workflow': wfjt.name, 'role': 'approval', 'state': state}, admin_user) + result = run_module('role', {'user': rando.username, 'workflow': wfjt.name, 'role': 'approval', 'state': state}, admin_user) assert not result.get('failed', False), result.get('msg', result) if state == 'present': @@ -81,7 +81,7 @@ def test_grant_workflow_approval_permission(run_module, admin_user, organization @pytest.mark.django_db def test_invalid_role(run_module, admin_user, project): rando = User.objects.create(username='rando') - result = run_module('tower_role', {'user': rando.username, 'project': project.name, 'role': 'adhoc', 'state': 'present'}, admin_user) + result = run_module('role', {'user': rando.username, 'project': project.name, 'role': 'adhoc', 'state': 'present'}, admin_user) assert result.get('failed', False) msg = result.get('msg') assert 'has no role adhoc_role' in msg diff --git a/awx_collection/test/awx/test_schedule.py b/awx_collection/test/awx/test_schedule.py index 1dfb150607..690da90202 100644 --- a/awx_collection/test/awx/test_schedule.py +++ b/awx_collection/test/awx/test_schedule.py @@ -13,7 +13,7 @@ from awx.api.serializers import SchedulePreviewSerializer @pytest.mark.django_db def test_create_schedule(run_module, job_template, admin_user): my_rrule = 'DTSTART;TZID=Zulu:20200416T034507 RRULE:FREQ=MONTHLY;INTERVAL=1' - result = run_module('tower_schedule', {'name': 'foo_schedule', 'unified_job_template': job_template.name, 'rrule': my_rrule}, admin_user) + result = run_module('schedule', {'name': 'foo_schedule', 'unified_job_template': job_template.name, 'rrule': my_rrule}, admin_user) assert not result.get('failed', False), result.get('msg', result) schedule = Schedule.objects.filter(name='foo_schedule').first() @@ -68,7 +68,7 @@ def test_create_schedule(run_module, job_template, admin_user): ], ) def test_rrule_lookup_plugin(collection_import, freq, kwargs, expect): - LookupModule = collection_import('plugins.lookup.tower_schedule_rrule').LookupModule + LookupModule = collection_import('plugins.lookup.schedule_rrule').LookupModule generated_rule = LookupModule.get_rrule(freq, kwargs) assert generated_rule == expect rrule_checker = SchedulePreviewSerializer() @@ -79,7 +79,7 @@ def test_rrule_lookup_plugin(collection_import, freq, kwargs, expect): @pytest.mark.parametrize("freq", ('none', 'minute', 'hour', 'day', 'week', 'month')) def test_empty_schedule_rrule(collection_import, freq): - LookupModule = collection_import('plugins.lookup.tower_schedule_rrule').LookupModule + LookupModule = collection_import('plugins.lookup.schedule_rrule').LookupModule if freq == 'day': pfreq = 'DAILY' elif freq == 'none': @@ -123,7 +123,7 @@ def test_empty_schedule_rrule(collection_import, freq): ], ) def test_rrule_lookup_plugin_failure(collection_import, freq, kwargs, msg): - LookupModule = collection_import('plugins.lookup.tower_schedule_rrule').LookupModule + LookupModule = collection_import('plugins.lookup.schedule_rrule').LookupModule with pytest.raises(AnsibleError) as e: assert LookupModule.get_rrule(freq, kwargs) assert msg in str(e.value) diff --git a/awx_collection/test/awx/test_send_receive.py b/awx_collection/test/awx/test_send_receive.py index c8a9b927e3..47f79e2733 100644 --- a/awx_collection/test/awx/test_send_receive.py +++ b/awx_collection/test/awx/test_send_receive.py @@ -30,7 +30,7 @@ def test_receive_send_jt(run_module, admin_user, mocker, silence_deprecation): jt.admin_role.members.add(admin_user) # work around send/receive bug # receive everything - result = run_module('tower_receive', dict(all=True), admin_user) + result = run_module('receive', dict(all=True), admin_user) assert 'assets' in result, result assets = result['assets'] @@ -47,7 +47,7 @@ def test_receive_send_jt(run_module, admin_user, mocker, silence_deprecation): # recreate everything with mocker.patch('sys.stdin.isatty', return_value=True): with mocker.patch('tower_cli.models.base.MonitorableResource.wait'): - result = run_module('tower_send', dict(assets=json.dumps(assets)), admin_user) + result = run_module('send', dict(assets=json.dumps(assets)), admin_user) assert not result.get('failed'), result diff --git a/awx_collection/test/awx/test_settings.py b/awx_collection/test/awx/test_settings.py index 241dafcfaa..69e823b3b9 100644 --- a/awx_collection/test/awx/test_settings.py +++ b/awx_collection/test/awx/test_settings.py @@ -10,7 +10,7 @@ from awx.conf.models import Setting @pytest.mark.django_db def test_setting_flat_value(run_module, admin_user): the_value = 'CN=service_account,OU=ServiceAccounts,DC=domain,DC=company,DC=org' - result = run_module('tower_settings', dict(name='AUTH_LDAP_BIND_DN', value=the_value), admin_user) + result = run_module('settings', dict(name='AUTH_LDAP_BIND_DN', value=the_value), admin_user) assert not result.get('failed', False), result.get('msg', result) assert result.get('changed'), result @@ -20,7 +20,7 @@ def test_setting_flat_value(run_module, admin_user): @pytest.mark.django_db def test_setting_dict_value(run_module, admin_user): the_value = {'email': 'mail', 'first_name': 'givenName', 'last_name': 'surname'} - result = run_module('tower_settings', dict(name='AUTH_LDAP_USER_ATTR_MAP', value=the_value), admin_user) + result = run_module('settings', dict(name='AUTH_LDAP_USER_ATTR_MAP', value=the_value), admin_user) assert not result.get('failed', False), result.get('msg', result) assert result.get('changed'), result @@ -30,7 +30,7 @@ def test_setting_dict_value(run_module, admin_user): @pytest.mark.django_db def test_setting_nested_type(run_module, admin_user): the_value = {'email': 'mail', 'first_name': 'givenName', 'last_name': 'surname'} - result = run_module('tower_settings', dict(settings={'AUTH_LDAP_USER_ATTR_MAP': the_value}), admin_user) + result = run_module('settings', dict(settings={'AUTH_LDAP_USER_ATTR_MAP': the_value}), admin_user) assert not result.get('failed', False), result.get('msg', result) assert result.get('changed'), result @@ -40,7 +40,7 @@ def test_setting_nested_type(run_module, admin_user): @pytest.mark.django_db def test_setting_bool_value(run_module, admin_user): for the_value in (True, False): - result = run_module('tower_settings', dict(name='ACTIVITY_STREAM_ENABLED_FOR_INVENTORY_SYNC', value=the_value), admin_user) + result = run_module('settings', dict(name='ACTIVITY_STREAM_ENABLED_FOR_INVENTORY_SYNC', value=the_value), admin_user) assert not result.get('failed', False), result.get('msg', result) assert result.get('changed'), result diff --git a/awx_collection/test/awx/test_team.py b/awx_collection/test/awx/test_team.py index e6c069ed74..ddbed70fbf 100644 --- a/awx_collection/test/awx/test_team.py +++ b/awx_collection/test/awx/test_team.py @@ -11,7 +11,7 @@ from awx.main.models import Organization, Team def test_create_team(run_module, admin_user): org = Organization.objects.create(name='foo') - result = run_module('tower_team', {'name': 'foo_team', 'description': 'fooin around', 'state': 'present', 'organization': 'foo'}, admin_user) + result = run_module('team', {'name': 'foo_team', 'description': 'fooin around', 'state': 'present', 'organization': 'foo'}, admin_user) team = Team.objects.filter(name='foo_team').first() @@ -32,7 +32,7 @@ def test_modify_team(run_module, admin_user): team = Team.objects.create(name='foo_team', organization=org, description='flat foo') assert team.description == 'flat foo' - result = run_module('tower_team', {'name': 'foo_team', 'description': 'fooin around', 'organization': 'foo'}, admin_user) + result = run_module('team', {'name': 'foo_team', 'description': 'fooin around', 'organization': 'foo'}, admin_user) team.refresh_from_db() result.pop('invocation') assert result == { @@ -42,6 +42,6 @@ def test_modify_team(run_module, admin_user): assert team.description == 'fooin around' # 2nd modification, should cause no change - result = run_module('tower_team', {'name': 'foo_team', 'description': 'fooin around', 'organization': 'foo'}, admin_user) + result = run_module('team', {'name': 'foo_team', 'description': 'fooin around', 'organization': 'foo'}, admin_user) result.pop('invocation') assert result == {"id": team.id, "changed": False} diff --git a/awx_collection/test/awx/test_token.py b/awx_collection/test/awx/test_token.py index 9633ff2024..a09cb4762e 100644 --- a/awx_collection/test/awx/test_token.py +++ b/awx_collection/test/awx/test_token.py @@ -22,7 +22,7 @@ def test_create_token(run_module, admin_user): 'tower_config_file': None, } - result = run_module('tower_token', module_args, admin_user) + result = run_module('token', module_args, admin_user) assert result.get('changed'), result tokens = OAuth2AccessToken.objects.filter(description='barfoo') diff --git a/awx_collection/test/awx/test_user.py b/awx_collection/test/awx/test_user.py index 49b857576b..1513b05a91 100644 --- a/awx_collection/test/awx/test_user.py +++ b/awx_collection/test/awx/test_user.py @@ -20,7 +20,7 @@ def mock_auth_stuff(): @pytest.mark.django_db def test_create_user(run_module, admin_user, mock_auth_stuff): - result = run_module('tower_user', dict(username='Bob', password='pass4word'), admin_user) + result = run_module('user', dict(username='Bob', password='pass4word'), admin_user) assert not result.get('failed', False), result.get('msg', result) assert result.get('changed'), result @@ -31,7 +31,7 @@ def test_create_user(run_module, admin_user, mock_auth_stuff): @pytest.mark.django_db def test_password_no_op_warning(run_module, admin_user, mock_auth_stuff, silence_warning): for i in range(2): - result = run_module('tower_user', dict(username='Bob', password='pass4word'), admin_user) + result = run_module('user', dict(username='Bob', password='pass4word'), admin_user) assert not result.get('failed', False), result.get('msg', result) assert result.get('changed') # not actually desired, but assert for sanity @@ -44,7 +44,7 @@ def test_password_no_op_warning(run_module, admin_user, mock_auth_stuff, silence @pytest.mark.django_db def test_update_password_on_create(run_module, admin_user, mock_auth_stuff): for i in range(2): - result = run_module('tower_user', dict(username='Bob', password='pass4word', update_secrets=False), admin_user) + result = run_module('user', dict(username='Bob', password='pass4word', update_secrets=False), admin_user) assert not result.get('failed', False), result.get('msg', result) assert not result.get('changed') @@ -52,11 +52,11 @@ def test_update_password_on_create(run_module, admin_user, mock_auth_stuff): @pytest.mark.django_db def test_update_user(run_module, admin_user, mock_auth_stuff): - result = run_module('tower_user', dict(username='Bob', password='pass4word', is_system_auditor=True), admin_user) + result = run_module('user', dict(username='Bob', password='pass4word', is_system_auditor=True), admin_user) assert not result.get('failed', False), result.get('msg', result) assert result.get('changed'), result - update_result = run_module('tower_user', dict(username='Bob', is_system_auditor=False), admin_user) + update_result = run_module('user', dict(username='Bob', is_system_auditor=False), admin_user) assert update_result.get('changed') user = User.objects.get(id=result['id']) diff --git a/awx_collection/test/awx/test_workflow_job_template.py b/awx_collection/test/awx/test_workflow_job_template.py index 0ad0d12aa6..c15325cfa9 100644 --- a/awx_collection/test/awx/test_workflow_job_template.py +++ b/awx_collection/test/awx/test_workflow_job_template.py @@ -10,7 +10,7 @@ from awx.main.models import WorkflowJobTemplate, NotificationTemplate @pytest.mark.django_db def test_create_workflow_job_template(run_module, admin_user, organization, survey_spec): result = run_module( - 'tower_workflow_job_template', + 'workflow_job_template', { 'name': 'foo-workflow', 'organization': organization.name, @@ -35,7 +35,7 @@ def test_create_workflow_job_template(run_module, admin_user, organization, surv @pytest.mark.django_db def test_create_modify_no_survey(run_module, admin_user, organization, survey_spec): - result = run_module('tower_workflow_job_template', {'name': 'foo-workflow', 'organization': organization.name}, admin_user) + result = run_module('workflow_job_template', {'name': 'foo-workflow', 'organization': organization.name}, admin_user) assert not result.get('failed', False), result.get('msg', result) assert result.get('changed', False), result @@ -45,7 +45,7 @@ def test_create_modify_no_survey(run_module, admin_user, organization, survey_sp result.pop('invocation', None) assert result == {"name": "foo-workflow", "id": wfjt.id, "changed": True} - result = run_module('tower_workflow_job_template', {'name': 'foo-workflow', 'organization': organization.name}, admin_user) + result = run_module('workflow_job_template', {'name': 'foo-workflow', 'organization': organization.name}, admin_user) assert not result.get('failed', False), result.get('msg', result) assert not result.get('changed', True), result @@ -53,7 +53,7 @@ def test_create_modify_no_survey(run_module, admin_user, organization, survey_sp @pytest.mark.django_db def test_survey_spec_only_changed(run_module, admin_user, organization, survey_spec): wfjt = WorkflowJobTemplate.objects.create(organization=organization, name='foo-workflow', survey_enabled=True, survey_spec=survey_spec) - result = run_module('tower_workflow_job_template', {'name': 'foo-workflow', 'organization': organization.name, 'state': 'present'}, admin_user) + result = run_module('workflow_job_template', {'name': 'foo-workflow', 'organization': organization.name, 'state': 'present'}, admin_user) assert not result.get('failed', False), result.get('msg', result) assert not result.get('changed', True), result wfjt.refresh_from_db() @@ -62,7 +62,7 @@ def test_survey_spec_only_changed(run_module, admin_user, organization, survey_s survey_spec['description'] = 'changed description' result = run_module( - 'tower_workflow_job_template', {'name': 'foo-workflow', 'organization': organization.name, 'survey_spec': survey_spec, 'state': 'present'}, admin_user + 'workflow_job_template', {'name': 'foo-workflow', 'organization': organization.name, 'survey_spec': survey_spec, 'state': 'present'}, admin_user ) assert not result.get('failed', False), result.get('msg', result) assert result.get('changed', True), result @@ -73,7 +73,7 @@ def test_survey_spec_only_changed(run_module, admin_user, organization, survey_s @pytest.mark.django_db def test_survey_spec_only_changed(run_module, admin_user, organization, survey_spec): wfjt = WorkflowJobTemplate.objects.create(organization=organization, name='foo-workflow', survey_enabled=True, survey_spec=survey_spec) - result = run_module('tower_workflow_job_template', {'name': 'foo-workflow', 'organization': organization.name, 'state': 'present'}, admin_user) + result = run_module('workflow_job_template', {'name': 'foo-workflow', 'organization': organization.name, 'state': 'present'}, admin_user) assert not result.get('failed', False), result.get('msg', result) assert not result.get('changed', True), result wfjt.refresh_from_db() @@ -82,7 +82,7 @@ def test_survey_spec_only_changed(run_module, admin_user, organization, survey_s del survey_spec['description'] result = run_module( - 'tower_workflow_job_template', {'name': 'foo-workflow', 'organization': organization.name, 'survey_spec': survey_spec, 'state': 'present'}, admin_user + 'workflow_job_template', {'name': 'foo-workflow', 'organization': organization.name, 'survey_spec': survey_spec, 'state': 'present'}, admin_user ) assert result.get('failed', True) assert result.get('msg') == "Failed to update survey: Field 'description' is missing from survey spec." @@ -107,7 +107,7 @@ def test_associate_only_on_success(run_module, admin_user, organization, project # test preservation of error NTs when success NTs are added result = run_module( - 'tower_workflow_job_template', {'name': 'foo-workflow', 'organization': organization.name, 'notification_templates_success': ['nt2']}, admin_user + 'workflow_job_template', {'name': 'foo-workflow', 'organization': organization.name, 'notification_templates_success': ['nt2']}, admin_user ) assert not result.get('failed', False), result.get('msg', result) assert result.get('changed', True), result @@ -116,9 +116,7 @@ def test_associate_only_on_success(run_module, admin_user, organization, project assert list(wfjt.notification_templates_error.values_list('id', flat=True)) == [nt1.id] # test removal to empty list - result = run_module( - 'tower_workflow_job_template', {'name': 'foo-workflow', 'organization': organization.name, 'notification_templates_success': []}, admin_user - ) + result = run_module('workflow_job_template', {'name': 'foo-workflow', 'organization': organization.name, 'notification_templates_success': []}, admin_user) assert not result.get('failed', False), result.get('msg', result) assert result.get('changed', True), result @@ -129,7 +127,7 @@ def test_associate_only_on_success(run_module, admin_user, organization, project @pytest.mark.django_db def test_delete_with_spec(run_module, admin_user, organization, survey_spec): WorkflowJobTemplate.objects.create(organization=organization, name='foo-workflow', survey_enabled=True, survey_spec=survey_spec) - result = run_module('tower_workflow_job_template', {'name': 'foo-workflow', 'organization': organization.name, 'state': 'absent'}, admin_user) + result = run_module('workflow_job_template', {'name': 'foo-workflow', 'organization': organization.name, 'state': 'absent'}, admin_user) assert not result.get('failed', False), result.get('msg', result) assert result.get('changed', True), result diff --git a/awx_collection/test/awx/test_workflow_job_template_node.py b/awx_collection/test/awx/test_workflow_job_template_node.py index 203eacc7e1..a4bc56a8f2 100644 --- a/awx_collection/test/awx/test_workflow_job_template_node.py +++ b/awx_collection/test/awx/test_workflow_job_template_node.py @@ -31,7 +31,7 @@ def wfjt(organization): def test_create_workflow_job_template_node(run_module, admin_user, wfjt, job_template): this_identifier = '42🐉' result = run_module( - 'tower_workflow_job_template_node', + 'workflow_job_template_node', { 'identifier': this_identifier, 'workflow_job_template': 'foo-workflow', @@ -58,7 +58,7 @@ def test_create_workflow_job_template_node_approval_node(run_module, admin_user, """This is a part of the API contract for creating approval nodes""" this_identifier = '42🐉' result = run_module( - 'tower_workflow_job_template_node', + 'workflow_job_template_node', { 'identifier': this_identifier, 'workflow_job_template': wfjt.name, @@ -83,7 +83,7 @@ def test_create_workflow_job_template_node_approval_node(run_module, admin_user, @pytest.mark.django_db def test_make_use_of_prompts(run_module, admin_user, wfjt, job_template, machine_credential, vault_credential): result = run_module( - 'tower_workflow_job_template_node', + 'workflow_job_template_node', { 'identifier': '42', 'workflow_job_template': 'foo-workflow', @@ -113,7 +113,7 @@ def test_create_with_edges(run_module, admin_user, wfjt, job_template): ] result = run_module( - 'tower_workflow_job_template_node', + 'workflow_job_template_node', { 'identifier': '42', 'workflow_job_template': 'foo-workflow', diff --git a/awx_collection/test/awx/test_workflow_template.py b/awx_collection/test/awx/test_workflow_template.py index b44f6f4234..0776cc420b 100644 --- a/awx_collection/test/awx/test_workflow_template.py +++ b/awx_collection/test/awx/test_workflow_template.py @@ -10,7 +10,7 @@ from awx.main.models import WorkflowJobTemplate, JobTemplate, Project, Inventory @pytest.mark.django_db def test_create_workflow_job_template(run_module, admin_user, organization, survey_spec, silence_deprecation): result = run_module( - 'tower_workflow_template', + 'workflow_template', { 'name': 'foo-workflow', 'organization': organization.name, @@ -37,7 +37,7 @@ def test_with_nested_workflow(run_module, admin_user, organization, silence_depr wfjt1 = WorkflowJobTemplate.objects.create(name='first', organization=organization) result = run_module( - 'tower_workflow_template', + 'workflow_template', {'name': 'foo-workflow', 'organization': organization.name, 'schema': [{'workflow': wfjt1.name}], 'state': 'present'}, admin_user, ) @@ -58,7 +58,7 @@ def test_schema_with_branches(run_module, admin_user, organization, silence_depr inv_src = InventorySource.objects.create(inventory=inv, name='AWS servers', source='ec2') result = run_module( - 'tower_workflow_template', + 'workflow_template', { 'name': 'foo-workflow', 'organization': organization.name, @@ -96,7 +96,7 @@ def test_schema_with_branches(run_module, admin_user, organization, silence_depr @pytest.mark.django_db def test_with_missing_ujt(run_module, admin_user, organization, silence_deprecation): result = run_module( - 'tower_workflow_template', {'name': 'foo-workflow', 'organization': organization.name, 'schema': [{'foo': 'bar'}], 'state': 'present'}, admin_user + 'workflow_template', {'name': 'foo-workflow', 'organization': organization.name, 'schema': [{'foo': 'bar'}], 'state': 'present'}, admin_user ) assert result.get('failed', False), result assert 'You should provide exactly one of the attributes job_template,' in result['msg'] diff --git a/awx_collection/tests/integration/targets/ad_hoc_command/tasks/main.yml b/awx_collection/tests/integration/targets/ad_hoc_command/tasks/main.yml index 280bd42a79..b5e8a9f529 100644 --- a/awx_collection/tests/integration/targets/ad_hoc_command/tasks/main.yml +++ b/awx_collection/tests/integration/targets/ad_hoc_command/tasks/main.yml @@ -35,7 +35,7 @@ state: present - name: Launch an Ad Hoc Command waiting for it to finish - tower_ad_hoc_command: + ad_hoc_command: inventory: "{{ inv_name }}" credential: "{{ ssh_cred_name }}" module_name: "command" @@ -49,7 +49,7 @@ - "result.status == 'successful'" - name: Launch an Ad Hoc Command without module argument - tower_ad_hoc_command: + ad_hoc_command: inventory: "Demo Inventory" credential: "{{ ssh_cred_name }}" module_name: "ping" @@ -62,7 +62,7 @@ - "result.status == 'successful'" - name: Check module fails with correct msg - tower_ad_hoc_command: + ad_hoc_command: inventory: "{{ inv_name }}" credential: "{{ ssh_cred_name }}" module_name: "Does not exist" diff --git a/awx_collection/tests/integration/targets/ad_hoc_command_cancel/tasks/main.yml b/awx_collection/tests/integration/targets/ad_hoc_command_cancel/tasks/main.yml index eab310b1ab..716bd1507c 100644 --- a/awx_collection/tests/integration/targets/ad_hoc_command_cancel/tasks/main.yml +++ b/awx_collection/tests/integration/targets/ad_hoc_command_cancel/tasks/main.yml @@ -35,7 +35,7 @@ state: present - name: Launch an Ad Hoc Command - tower_ad_hoc_command: + ad_hoc_command: inventory: "{{ inv_name }}" credential: "{{ ssh_cred_name }}" module_name: "command" @@ -47,7 +47,7 @@ - "command is changed" - name: Timeout waiting for the command to cancel - tower_ad_hoc_command_cancel: + ad_hoc_command_cancel: command_id: "{{ command.id }}" timeout: -1 register: results @@ -59,7 +59,7 @@ - "results['msg'] == 'Monitoring of ad hoc command aborted due to timeout'" - name: Cancel the command with hard error if it's not running - tower_ad_hoc_command_cancel: + ad_hoc_command_cancel: command_id: "{{ command.id }}" fail_if_not_running: true register: results @@ -70,7 +70,7 @@ - results is failed - name: Cancel an already canceled command (assert failure) - tower_ad_hoc_command_cancel: + ad_hoc_command_cancel: command_id: "{{ command.id }}" fail_if_not_running: true register: results @@ -81,7 +81,7 @@ - results is failed - name: Check module fails with correct msg - tower_ad_hoc_command_cancel: + ad_hoc_command_cancel: command_id: 9999999999 register: result ignore_errors: true diff --git a/awx_collection/tests/integration/targets/ad_hoc_command_wait/tasks/main.yml b/awx_collection/tests/integration/targets/ad_hoc_command_wait/tasks/main.yml index fbd539330a..e92627c810 100644 --- a/awx_collection/tests/integration/targets/ad_hoc_command_wait/tasks/main.yml +++ b/awx_collection/tests/integration/targets/ad_hoc_command_wait/tasks/main.yml @@ -35,7 +35,7 @@ state: present - name: Check module fails with correct msg - tower_ad_hoc_command_wait: + ad_hoc_command_wait: command_id: "99999999" register: result ignore_errors: true @@ -46,7 +46,7 @@ - "result.msg == 'Unable to wait on ad hoc command 99999999; that ID does not exist in Tower.'" - name: Launch command module with sleep 10 - tower_ad_hoc_command: + ad_hoc_command: inventory: "{{ inv_name }}" credential: "{{ ssh_cred_name }}" module_name: "command" @@ -58,7 +58,7 @@ - command is changed - name: Wait for the Job to finish - tower_ad_hoc_command_wait: + ad_hoc_command_wait: command_id: "{{ command.id }}" register: wait_results @@ -70,7 +70,7 @@ - "'id' in wait_results" - name: Launch a long running command - tower_ad_hoc_command: + ad_hoc_command: inventory: "{{ inv_name }}" credential: "{{ ssh_cred_name }}" module_name: "command" @@ -82,7 +82,7 @@ - command is changed - name: Timeout waiting for the command to complete - tower_ad_hoc_command_wait: + ad_hoc_command_wait: command_id: "{{ command.id }}" timeout: 1 ignore_errors: true @@ -95,13 +95,13 @@ - "'id' in wait_results" - name: Async cancel the long-running command - tower_ad_hoc_command_cancel: + ad_hoc_command_cancel: command_id: "{{ command.id }}" async: 3600 poll: 0 - name: Wait for the command to exit on cancel - tower_ad_hoc_command_wait: + ad_hoc_command_wait: command_id: "{{ command.id }}" register: wait_results ignore_errors: true diff --git a/awx_collection/tests/integration/targets/credential_input_source/tasks/main.yml b/awx_collection/tests/integration/targets/credential_input_source/tasks/main.yml index 382b105a5c..83fc112e76 100644 --- a/awx_collection/tests/integration/targets/credential_input_source/tasks/main.yml +++ b/awx_collection/tests/integration/targets/credential_input_source/tasks/main.yml @@ -40,7 +40,7 @@ - "target_cred_result is changed" - name: Add credential Input Source - tower_credential_input_source: + credential_input_source: input_field_name: password target_credential: "{{ target_cred_result.id }}" source_credential: "{{ src_cred_result.id }}" @@ -66,7 +66,7 @@ register: result - name: Change credential Input Source - tower_credential_input_source: + credential_input_source: input_field_name: password target_credential: "{{ target_cred_name }}" source_credential: "{{ src_cred_name }}-2" @@ -78,7 +78,7 @@ always: - name: Remove a Tower credential source - tower_credential_input_source: + credential_input_source: input_field_name: password target_credential: "{{ target_cred_name }}" state: absent diff --git a/awx_collection/tests/integration/targets/credential_type/tasks/main.yml b/awx_collection/tests/integration/targets/credential_type/tasks/main.yml index a38f2eeaae..bf4bb19933 100644 --- a/awx_collection/tests/integration/targets/credential_type/tasks/main.yml +++ b/awx_collection/tests/integration/targets/credential_type/tasks/main.yml @@ -4,7 +4,7 @@ cred_type_name: "AWX-Collection-tests-tower_credential_type-cred-type-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - name: Add Tower credential type - tower_credential_type: + credential_type: description: Credential type for Test name: "{{ cred_type_name }}" kind: cloud @@ -17,7 +17,7 @@ - "result is changed" - name: Remove a Tower credential type - tower_credential_type: + credential_type: name: "{{ result.id }}" state: absent register: result diff --git a/awx_collection/tests/integration/targets/demo_data/tasks/main.yml b/awx_collection/tests/integration/targets/demo_data/tasks/main.yml index 06ac9a971f..db152671bd 100644 --- a/awx_collection/tests/integration/targets/demo_data/tasks/main.yml +++ b/awx_collection/tests/integration/targets/demo_data/tasks/main.yml @@ -9,7 +9,7 @@ scm_type: git state: absent loop: > - {{ query('awx.awx.tower_api', 'projects', + {{ query('awx.awx.controller_api', 'projects', query_params={'organization__isnull': true, 'name': 'Demo Project'}) }} loop_control: @@ -38,7 +38,7 @@ register: result - name: Assure that demo job template exists - tower_job_template: + job_template: name: "Demo Job Template" project: "Demo Project" inventory: "Demo Inventory" diff --git a/awx_collection/tests/integration/targets/group/tasks/main.yml b/awx_collection/tests/integration/targets/group/tasks/main.yml index 2fc4e4a42b..313cb55ae4 100644 --- a/awx_collection/tests/integration/targets/group/tasks/main.yml +++ b/awx_collection/tests/integration/targets/group/tasks/main.yml @@ -93,7 +93,7 @@ - name: "Find number of hosts in {{ group_name1 }}" set_fact: - group1_host_count: "{{ lookup('awx.awx.tower_api', 'groups/{{result.id}}/all_hosts/') |length}}" + group1_host_count: "{{ lookup('awx.awx.controller_api', 'groups/{{result.id}}/all_hosts/') |length}}" - assert: that: diff --git a/awx_collection/tests/integration/targets/instance_group/tasks/main.yml b/awx_collection/tests/integration/targets/instance_group/tasks/main.yml index b763f5636a..8d526d7fd7 100644 --- a/awx_collection/tests/integration/targets/instance_group/tasks/main.yml +++ b/awx_collection/tests/integration/targets/instance_group/tasks/main.yml @@ -26,7 +26,7 @@ - "cred_result is changed" - name: Create an Instance Group - tower_instance_group: + instance_group: name: "{{ group_name1 }}" policy_instance_percentage: 34 policy_instance_minimum: 12 @@ -38,7 +38,7 @@ - "result is changed" - name: Update an Instance Group - tower_instance_group: + instance_group: name: "{{ result.id }}" policy_instance_percentage: 34 policy_instance_minimum: 24 @@ -50,7 +50,7 @@ - "result is changed" - name: Create a container group - tower_instance_group: + instance_group: name: "{{ group_name2 }}" credential: "{{ cred_result.id }}" is_container_group: true @@ -62,7 +62,7 @@ always: - name: Delete the instance groups - tower_instance_group: + instance_group: name: "{{ item }}" state: absent loop: diff --git a/awx_collection/tests/integration/targets/inventory/tasks/main.yml b/awx_collection/tests/integration/targets/inventory/tasks/main.yml index 6d2f27094d..0171f9a0b9 100644 --- a/awx_collection/tests/integration/targets/inventory/tasks/main.yml +++ b/awx_collection/tests/integration/targets/inventory/tasks/main.yml @@ -13,7 +13,7 @@ - block: - name: Create an Instance Group - tower_instance_group: + instance_group: name: "{{ group_name1 }}" state: present register: result @@ -174,7 +174,7 @@ - "copy_{{ inv_name1 }}" - name: Delete the instance groups - tower_instance_group: + instance_group: name: "{{ group_name1 }}" state: absent diff --git a/awx_collection/tests/integration/targets/inventory_source/tasks/main.yml b/awx_collection/tests/integration/targets/inventory_source/tasks/main.yml index 7878e8fa22..56abbb0afa 100644 --- a/awx_collection/tests/integration/targets/inventory_source/tasks/main.yml +++ b/awx_collection/tests/integration/targets/inventory_source/tasks/main.yml @@ -25,7 +25,7 @@ name: "{{ openstack_inv }}" - name: Create a source inventory - tower_inventory_source: + inventory_source: name: "{{ openstack_inv_source }}" description: Source for Test inventory inventory: "{{ openstack_inv }}" @@ -42,7 +42,7 @@ - "result is changed" - name: Delete the inventory source with an invalid cred and source_project specified - tower_inventory_source: + inventory_source: name: "{{ result.id }}" inventory: "{{ openstack_inv }}" credential: "Does Not Exit" diff --git a/awx_collection/tests/integration/targets/inventory_source_update/tasks/main.yml b/awx_collection/tests/integration/targets/inventory_source_update/tasks/main.yml index a8a78f7a87..435770302a 100644 --- a/awx_collection/tests/integration/targets/inventory_source_update/tasks/main.yml +++ b/awx_collection/tests/integration/targets/inventory_source_update/tasks/main.yml @@ -42,7 +42,7 @@ register: created_inventory - name: Create an Inventory Source (specifically connected to the randomly generated org) - tower_inventory_source: + inventory_source: name: "{{ inv_source1 }}" source: scm source_project: "{{ project_name }}" @@ -52,7 +52,7 @@ inventory: "{{ inv_name }}" - name: Create Another Inventory Source - tower_inventory_source: + inventory_source: name: "{{ inv_source2 }}" source: scm source_project: "{{ project_name }}" @@ -62,7 +62,7 @@ inventory: "{{ inv_name }}" - name: Create Yet Another Inventory Source (to make lookup plugin find multiple inv sources) - tower_inventory_source: + inventory_source: name: "{{ inv_source3 }}" source: scm source_project: "{{ project_name }}" @@ -72,7 +72,7 @@ inventory: "{{ inv_name }}" - name: Test Inventory Source Update - tower_inventory_source_update: + inventory_source_update: name: "{{ inv_source2 }}" inventory: "{{ inv_name }}" organization: Default @@ -83,12 +83,12 @@ - "result is changed" - name: Test Inventory Source Update for All Sources - tower_inventory_source_update: + inventory_source_update: name: "{{ item.name }}" inventory: "{{ inv_name }}" organization: Default wait: true - loop: "{{ query('awx.awx.tower_api', 'inventory_sources', query_params={ 'inventory': created_inventory.id }, expect_objects=True, return_objects=True) }}" + loop: "{{ query('awx.awx.controller_api', 'inventory_sources', query_params={ 'inventory': created_inventory.id }, expect_objects=True, return_objects=True) }}" loop_control: label: "{{ item.name }}" register: result @@ -98,12 +98,12 @@ - "result is changed" - name: Test Inventory Source Update for All Sources (using inventory_source as alias for name) - tower_inventory_source_update: + inventory_source_update: inventory_source: "{{ item.name }}" inventory: "{{ inv_name }}" organization: Default wait: true - loop: "{{ query('awx.awx.tower_api', 'inventory_sources', query_params={ 'inventory': created_inventory.id }, expect_objects=True, return_objects=True) }}" + loop: "{{ query('awx.awx.controller_api', 'inventory_sources', query_params={ 'inventory': created_inventory.id }, expect_objects=True, return_objects=True) }}" loop_control: label: "{{ item.name }}" register: result diff --git a/awx_collection/tests/integration/targets/job_cancel/tasks/main.yml b/awx_collection/tests/integration/targets/job_cancel/tasks/main.yml index d949610d98..254ea89ce7 100644 --- a/awx_collection/tests/integration/targets/job_cancel/tasks/main.yml +++ b/awx_collection/tests/integration/targets/job_cancel/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Launch a Job Template - tower_job_launch: + job_launch: job_template: "Demo Job Template" register: job @@ -9,7 +9,7 @@ - "job is changed" - name: Cancel the job - tower_job_cancel: + job_cancel: job_id: "{{ job.id }}" register: results @@ -18,7 +18,7 @@ - results is changed - name: Cancel an already canceled job (assert failure) - tower_job_cancel: + job_cancel: job_id: "{{ job.id }}" fail_if_not_running: true register: results @@ -29,7 +29,7 @@ - results is failed - name: Check module fails with correct msg - tower_job_cancel: + job_cancel: job_id: 9999999999 register: result ignore_errors: true diff --git a/awx_collection/tests/integration/targets/job_launch/tasks/main.yml b/awx_collection/tests/integration/targets/job_launch/tasks/main.yml index 6828fbc93e..9d98c9fe36 100644 --- a/awx_collection/tests/integration/targets/job_launch/tasks/main.yml +++ b/awx_collection/tests/integration/targets/job_launch/tasks/main.yml @@ -6,7 +6,7 @@ proj_name: "AWX-Collection-tests-tower_job_launch-project-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - name: Launch a Job Template - tower_job_launch: + job_launch: job_template: "Demo Job Template" register: result @@ -16,7 +16,7 @@ - "result.status == 'pending'" - name: Wait for a job template to complete - tower_job_wait: + job_wait: job_id: "{{ result.id }}" max_interval: 10 timeout: 120 @@ -28,7 +28,7 @@ - "result.status == 'successful'" - name: Check module fails with correct msg - tower_job_launch: + job_launch: job_template: "Non_Existing_Job_Template" inventory: "Demo Inventory" register: result @@ -41,7 +41,7 @@ - "'Non_Existing_Job_Template' in result.msg" - name: Create a Job Template for testing prompt on launch - tower_job_template: + job_template: name: "{{ jt_name1 }}" project: Demo Project playbook: hello_world.yml @@ -54,7 +54,7 @@ register: result - name: Launch job template with inventory and credential for prompt on launch - tower_job_launch: + job_launch: job_template: "{{ jt_name1 }}" inventory: "Demo Inventory" credential: "Demo Credential" @@ -77,7 +77,7 @@ scm_url: https://github.com/ansible/test-playbooks - name: Create the job template with survey - tower_job_template: + job_template: name: "{{ jt_name2 }}" project: "{{ proj_name }}" playbook: debug.yml @@ -114,7 +114,7 @@ new_question: true - name: Kick off a job template with survey - tower_job_launch: + job_launch: job_template: "{{ jt_name2 }}" extra_vars: basic_name: My First Variable @@ -127,14 +127,14 @@ - result is not failed - name: Prompt the job templates extra_vars on launch - tower_job_template: + job_template: name: "{{ jt_name2 }}" state: present ask_variables_on_launch: true - name: Kick off a job template with extra_vars - tower_job_launch: + job_launch: job_template: "{{ jt_name2 }}" extra_vars: basic_name: My First Variable @@ -148,7 +148,7 @@ - result is not failed - name: Create a Job Template for testing extra_vars - tower_job_template: + job_template: name: "{{ jt_name2 }}" project: "{{ proj_name }}" playbook: debug.yml @@ -161,7 +161,7 @@ register: result - name: Launch job template with inventory and credential for prompt on launch - tower_job_launch: + job_launch: job_template: "{{ jt_name2 }}" organization: Default register: result @@ -171,7 +171,7 @@ - "result is changed" - name: Wait for a job template to complete - tower_job_wait: + job_wait: job_id: "{{ result.id }}" max_interval: 10 timeout: 120 @@ -183,7 +183,7 @@ - "result.status == 'successful'" - name: Get the job - tower_job_list: + job_list: query: {"id": "{{result.id}}"} register: result @@ -192,7 +192,7 @@ - '{"foo": "bar"} | to_json in result.results[0].extra_vars' - name: Delete the first jt - tower_job_template: + job_template: name: "{{ jt_name1 }}" project: Demo Project playbook: hello_world.yml @@ -204,7 +204,7 @@ - "result is changed" - name: Delete the second jt - tower_job_template: + job_template: name: "{{ jt_name2 }}" project: "{{ proj_name }}" playbook: debug.yml diff --git a/awx_collection/tests/integration/targets/job_list/tasks/main.yml b/awx_collection/tests/integration/targets/job_list/tasks/main.yml index a883f28d87..04495bfcba 100644 --- a/awx_collection/tests/integration/targets/job_list/tasks/main.yml +++ b/awx_collection/tests/integration/targets/job_list/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Launch a Job Template - tower_job_launch: + job_launch: job_template: "Demo Job Template" register: job @@ -10,7 +10,7 @@ - "job.status == 'pending'" - name: List jobs w/ a matching primary key - tower_job_list: + job_list: query: {"id": "{{ job.id }}"} register: matching_jobs @@ -19,7 +19,7 @@ - "{{ matching_jobs.count }} == 1" - name: List failed jobs (which don't exist) - tower_job_list: + job_list: status: failed query: {"id": "{{ job.id }}"} register: successful_jobs @@ -29,7 +29,7 @@ - "{{ successful_jobs.count }} == 0" - name: Get ALL result pages! - tower_job_list: + job_list: all_pages: true register: all_page_query diff --git a/awx_collection/tests/integration/targets/job_template/tasks/main.yml b/awx_collection/tests/integration/targets/job_template/tasks/main.yml index b32af29e92..7dd1daad86 100644 --- a/awx_collection/tests/integration/targets/job_template/tasks/main.yml +++ b/awx_collection/tests/integration/targets/job_template/tasks/main.yml @@ -61,7 +61,7 @@ - "{{ org_name }}" - name: Create an Instance Group - tower_instance_group: + instance_group: name: "{{ group_name1 }}" state: present register: result @@ -71,7 +71,7 @@ - "result is changed" - name: Add email notification - tower_notification_template: + notification_template: name: "{{ email_not }}" organization: Default notification_type: email @@ -87,7 +87,7 @@ state: present - name: Add webhook notification - tower_notification_template: + notification_template: name: "{{ webhook_not }}" organization: Default notification_type: webhook @@ -98,7 +98,7 @@ register: result - name: Create Job Template 1 - tower_job_template: + job_template: name: "{{ jt1 }}" project: "{{ proj1 }}" inventory: Demo Inventory @@ -117,7 +117,7 @@ - "jt1_result is changed" - name: Add a credential to this JT - tower_job_template: + job_template: name: "{{ jt1 }}" project: "{{ proj_result.id }}" playbook: hello_world.yml @@ -130,7 +130,7 @@ - "result is changed" - name: Try to add the same credential to this JT - tower_job_template: + job_template: name: "{{ jt1_result.id }}" project: "{{ proj1 }}" playbook: hello_world.yml @@ -143,7 +143,7 @@ - "result is not changed" - name: Add another credential to this JT - tower_job_template: + job_template: name: "{{ jt1 }}" project: "{{ proj1 }}" playbook: hello_world.yml @@ -157,7 +157,7 @@ - "result is changed" - name: Remove a credential for this JT - tower_job_template: + job_template: name: "{{ jt1 }}" project: "{{ proj1 }}" playbook: hello_world.yml @@ -170,7 +170,7 @@ - "result is changed" - name: Remove all credentials from this JT - tower_job_template: + job_template: name: "{{ jt1 }}" project: "{{ proj1 }}" playbook: hello_world.yml @@ -182,13 +182,13 @@ - "result is changed" - name: Copy Job Template - tower_job_template: + job_template: name: "copy_{{ jt1 }}" copy_from: "{{ jt1 }}" state: "present" - name: Delete copied Job Template - tower_job_template: + job_template: name: "copy_{{ jt1 }}" job_type: run state: absent @@ -196,7 +196,7 @@ # This doesnt work if you include the credentials parameter - name: Delete Job Template 1 - tower_job_template: + job_template: name: "{{ jt1 }}" playbook: hello_world.yml job_type: run @@ -211,7 +211,7 @@ - "result is changed" - name: Create Job Template 2 - tower_job_template: + job_template: name: "{{ jt2 }}" organization: Default project: "{{ proj1 }}" @@ -229,7 +229,7 @@ - "result is changed" - name: Add survey to Job Template 2 - tower_job_template: + job_template: name: "{{ jt2 }}" survey_enabled: true survey_spec: @@ -251,7 +251,7 @@ - "result is changed" - name: Re Add survey to Job Template 2 - tower_job_template: + job_template: name: "{{ jt2 }}" survey_enabled: true survey_spec: @@ -273,7 +273,7 @@ - "result is not changed" - name: Add question to survey to Job Template 2 - tower_job_template: + job_template: name: "{{ jt2 }}" survey_enabled: true survey_spec: @@ -300,7 +300,7 @@ - "result is changed" - name: Remove survey from Job Template 2 - tower_job_template: + job_template: name: "{{ jt2 }}" survey_enabled: false survey_spec: {} @@ -311,7 +311,7 @@ - "result is changed" - name: Add started notifications to Job Template 2 - tower_job_template: + job_template: name: "{{ jt2 }}" notification_templates_started: - "{{ email_not }}" @@ -323,7 +323,7 @@ - "result is changed" - name: Re Add started notifications to Job Template 2 - tower_job_template: + job_template: name: "{{ jt2 }}" notification_templates_started: - "{{ email_not }}" @@ -335,7 +335,7 @@ - "result is not changed" - name: Add success notifications to Job Template 2 - tower_job_template: + job_template: name: "{{ jt2 }}" notification_templates_success: - "{{ email_not }}" @@ -347,7 +347,7 @@ - "result is changed" - name: Remove "on start" webhook notification from Job Template 2 - tower_job_template: + job_template: name: "{{ jt2 }}" notification_templates_started: - "{{ email_not }}" @@ -359,7 +359,7 @@ - name: Delete Job Template 2 - tower_job_template: + job_template: name: "{{ jt2 }}" project: "{{ proj1 }}" inventory: Demo Inventory @@ -406,18 +406,18 @@ # You can't delete a label directly so no cleanup needed - name: Delete email notification - tower_notification_template: + notification_template: name: "{{ email_not }}" organization: Default state: absent - name: Delete the instance groups - tower_instance_group: + instance_group: name: "{{ group_name1 }}" state: absent - name: Delete webhook notification - tower_notification_template: + notification_template: name: "{{ webhook_not }}" organization: Default state: absent diff --git a/awx_collection/tests/integration/targets/job_wait/tasks/main.yml b/awx_collection/tests/integration/targets/job_wait/tasks/main.yml index d21e75b8e6..5187dc7da8 100644 --- a/awx_collection/tests/integration/targets/job_wait/tasks/main.yml +++ b/awx_collection/tests/integration/targets/job_wait/tasks/main.yml @@ -13,7 +13,7 @@ organization: Default - name: Create a job template - tower_job_template: + job_template: name: "{{ jt_name }}" playbook: "sleep.yml" job_type: run @@ -23,7 +23,7 @@ sleep_interval: 300 - name: Check deprecation warnings - tower_job_wait: + job_wait: min_interval: 10 max_interval: 20 job_id: "99999999" @@ -35,7 +35,7 @@ - "'Min and max interval have been deprecated, please use interval instead; interval will be set to 15'" - name: Validate that interval superceeds min/max - tower_job_wait: + job_wait: min_interval: 10 max_interval: 20 interval: 12 @@ -49,7 +49,7 @@ 'min and max interval have been depricated, please use interval instead, interval will be set to 12'" - name: Check module fails with correct msg - tower_job_wait: + job_wait: job_id: "99999999" register: result ignore_errors: true @@ -61,7 +61,7 @@ 'Unable to wait on job 99999999; that ID does not exist in Tower.'" - name: Launch Demo Job Template (take happy path) - tower_job_launch: + job_launch: job_template: "Demo Job Template" register: job @@ -70,7 +70,7 @@ - job is changed - name: Wait for the Job to finish - tower_job_wait: + job_wait: job_id: "{{ job.id }}" register: wait_results @@ -82,7 +82,7 @@ - "'id' in wait_results" - name: Launch a long running job - tower_job_launch: + job_launch: job_template: "{{ jt_name }}" register: job @@ -91,7 +91,7 @@ - job is changed - name: Timeout waiting for the job to complete - tower_job_wait: + job_wait: job_id: "{{ job.id }}" timeout: 5 ignore_errors: true @@ -104,13 +104,13 @@ - "'id' in wait_results" - name: Async cancel the long running job - tower_job_cancel: + job_cancel: job_id: "{{ job.id }}" async: 3600 poll: 0 - name: Wait for the job to exit on cancel - tower_job_wait: + job_wait: job_id: "{{ job.id }}" register: wait_results ignore_errors: true @@ -122,7 +122,7 @@ - "wait_results.msg == 'Job with id {{ job.id }} failed' or 'Job with id={{ job.id }} failed, error: Job failed.'" - name: Delete the job template - tower_job_template: + job_template: name: "{{ jt_name }}" playbook: "sleep.yml" job_type: run @@ -147,25 +147,25 @@ wfjt_name2: "AWX-Collection-tests-tower_workflow_launch--wfjt1-{{ test_id1 }}" - name: Create our workflow - tower_workflow_job_template: + workflow_job_template: name: "{{ wfjt_name2 }}" state: present - name: Add a node - tower_workflow_job_template_node: + workflow_job_template_node: workflow_job_template: "{{ wfjt_name2 }}" unified_job_template: "Demo Job Template" identifier: leaf register: new_node - name: Kick off a workflow - tower_workflow_launch: + workflow_launch: workflow_template: "{{ wfjt_name2 }}" ignore_errors: true register: workflow - name: Wait for the Workflow Job to finish - tower_job_wait: + job_wait: job_id: "{{ workflow.job_info.id }}" job_type: "workflow_jobs" register: wait_workflow_results @@ -178,6 +178,6 @@ - "'id' in wait_workflow_results" - name: Clean up test workflow - tower_workflow_job_template: + workflow_job_template: name: "{{ wfjt_name2 }}" state: absent diff --git a/awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml b/awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml index 7c4ea04799..416ec855bd 100644 --- a/awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml +++ b/awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml @@ -21,7 +21,7 @@ - name: Generate the name of our plugin set_fact: - plugin_name: "{{ tower_meta.prefix }}.tower_api" + plugin_name: "{{ tower_meta.prefix }}.controller_api" - name: Create all of our users user: @@ -177,7 +177,7 @@ # DOCS Example Tests - name: Load the UI settings set_fact: - tower_settings: "{{ lookup('awx.awx.tower_api', 'settings/ui') }}" + tower_settings: "{{ lookup('awx.awx.controller_api', 'settings/ui') }}" - assert: that: @@ -185,7 +185,7 @@ - name: Display the usernames of all admin users debug: - msg: "Admin users: {{ query('awx.awx.tower_api', 'users', query_params={ 'is_superuser': true }) | map(attribute='username') | join(', ') }}" + msg: "Admin users: {{ query('awx.awx.controller_api', 'users', query_params={ 'is_superuser': true }) | map(attribute='username') | join(', ') }}" register: results - assert: @@ -195,7 +195,7 @@ - name: debug all organizations in a loop # use query to return a list debug: msg: "Organization description={{ item['description'] }} id={{ item['id'] }}" - loop: "{{ query('awx.awx.tower_api', 'organizations') }}" + loop: "{{ query('awx.awx.controller_api', 'organizations') }}" loop_control: label: "{{ item['name'] }}" @@ -206,7 +206,7 @@ user: "{{ usernames[0] }}" state: absent register: tower_role_revoke - when: "query('awx.awx.tower_api', 'users', query_params={ 'username': 'DNE_TESTING' }) | length == 1" + when: "query('awx.awx.controller_api', 'users', query_params={ 'username': 'DNE_TESTING' }) | length == 1" - assert: that: @@ -218,7 +218,7 @@ inventory: "Demo Inventory" hosts: >- {{ query( - 'awx.awx.tower_api', + 'awx.awx.controller_api', 'hosts', query_params={ 'name__endswith' : test_id, }, ) | map(attribute='name') | list }} diff --git a/awx_collection/tests/integration/targets/notification_template/tasks/main.yml b/awx_collection/tests/integration/targets/notification_template/tasks/main.yml index af43b7d325..89514b3598 100644 --- a/awx_collection/tests/integration/targets/notification_template/tasks/main.yml +++ b/awx_collection/tests/integration/targets/notification_template/tasks/main.yml @@ -9,7 +9,7 @@ irc_not: "AWX-Collection-tests-tower_notification_template-irc-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - name: Test deprecation warnings with legacy name - tower_notification_template: + notification_template: name: "{{ slack_not }}" organization: Default notification_type: slack @@ -54,7 +54,7 @@ - result['deprecations'] | length() == 25 - name: Create Slack notification with custom messages - tower_notification_template: + notification_template: name: "{{ slack_not }}" organization: Default notification_type: slack @@ -76,7 +76,7 @@ - result is changed - name: Delete Slack notification - tower_notification_template: + notification_template: name: "{{ slack_not }}" organization: Default state: absent @@ -87,7 +87,7 @@ - result is changed - name: Add webhook notification - tower_notification_template: + notification_template: name: "{{ webhook_not }}" organization: Default notification_type: webhook @@ -102,7 +102,7 @@ - result is changed - name: Delete webhook notification - tower_notification_template: + notification_template: name: "{{ webhook_not }}" organization: Default state: absent @@ -113,7 +113,7 @@ - result is changed - name: Add email notification - tower_notification_template: + notification_template: name: "{{ email_not }}" organization: Default notification_type: email @@ -134,7 +134,7 @@ - result is changed - name: Copy email notification - tower_notification_template: + notification_template: name: "copy_{{ email_not }}" copy_from: "{{ email_not }}" organization: Default @@ -145,7 +145,7 @@ - result.copied - name: Delete copied email notification - tower_notification_template: + notification_template: name: "copy_{{ email_not }}" organization: Default state: absent @@ -156,7 +156,7 @@ - result is changed - name: Delete email notification - tower_notification_template: + notification_template: name: "{{ email_not }}" organization: Default state: absent @@ -167,7 +167,7 @@ - result is changed - name: Add twilio notification - tower_notification_template: + notification_template: name: "{{ twillo_not }}" organization: Default notification_type: twilio @@ -184,7 +184,7 @@ - result is changed - name: Delete twilio notification - tower_notification_template: + notification_template: name: "{{ twillo_not }}" organization: Default state: absent @@ -195,7 +195,7 @@ - result is changed - name: Add PagerDuty notification - tower_notification_template: + notification_template: name: "{{ pd_not }}" organization: Default notification_type: pagerduty @@ -211,7 +211,7 @@ - result is changed - name: Delete PagerDuty notification - tower_notification_template: + notification_template: name: "{{ pd_not }}" organization: Default state: absent @@ -222,7 +222,7 @@ - result is changed - name: Add IRC notification - tower_notification_template: + notification_template: name: "{{ irc_not }}" organization: Default notification_type: irc @@ -241,7 +241,7 @@ - result is changed - name: Delete IRC notification - tower_notification_template: + notification_template: name: "{{ irc_not }}" organization: Default state: absent diff --git a/awx_collection/tests/integration/targets/organization/tasks/main.yml b/awx_collection/tests/integration/targets/organization/tasks/main.yml index 8fae9a81d8..5769d7c9b9 100644 --- a/awx_collection/tests/integration/targets/organization/tasks/main.yml +++ b/awx_collection/tests/integration/targets/organization/tasks/main.yml @@ -34,7 +34,7 @@ - "result is not changed" - name: Create an Instance Group - tower_instance_group: + instance_group: name: "{{ group_name1 }}" state: present register: result @@ -66,7 +66,7 @@ - "result is changed" - name: Delete the instance groups - tower_instance_group: + instance_group: name: "{{ group_name1 }}" state: absent diff --git a/awx_collection/tests/integration/targets/project/tasks/main.yml b/awx_collection/tests/integration/targets/project/tasks/main.yml index 04a9e55a62..8a6f36ac24 100644 --- a/awx_collection/tests/integration/targets/project/tasks/main.yml +++ b/awx_collection/tests/integration/targets/project/tasks/main.yml @@ -158,7 +158,7 @@ - result is not changed - name: Create a job template that overrides the project scm_branch - tower_job_template: + job_template: name: "{{ jt1 }}" project: "{{ project_name3 }}" inventory: "Demo Inventory" @@ -166,7 +166,7 @@ playbook: debug.yml - name: Launch "{{ jt1 }}" - tower_job_launch: + job_launch: job_template: "{{ jt1 }}" register: result @@ -175,7 +175,7 @@ - result is changed - name: "wait for job {{ result.id }}" - tower_job_wait: + job_wait: job_id: "{{ result.id }}" register: job @@ -185,7 +185,7 @@ always: - name: Delete the test job_template - tower_job_template: + job_template: name: "{{ jt1 }}" project: "{{ project_name3 }}" inventory: "Demo Inventory" diff --git a/awx_collection/tests/integration/targets/project_manual/tasks/create_project_dir.yml b/awx_collection/tests/integration/targets/project_manual/tasks/create_project_dir.yml index 51beba1203..44c5648fb3 100644 --- a/awx_collection/tests/integration/targets/project_manual/tasks/create_project_dir.yml +++ b/awx_collection/tests/integration/targets/project_manual/tasks/create_project_dir.yml @@ -3,7 +3,7 @@ set_fact: project_base_dir: "{{ tower_settings.project_base_dir }}" vars: - tower_settings: "{{ lookup('awx.awx.tower_api', 'config/') }}" + tower_settings: "{{ lookup('awx.awx.controller_api', 'config/') }}" - inventory: name: localhost @@ -34,7 +34,7 @@ value: "[{{ project_base_dir }}]" - name: Create a directory for manual project - tower_ad_hoc_command: + ad_hoc_command: credential: dummy inventory: localhost job_type: run diff --git a/awx_collection/tests/integration/targets/project_update/tasks/main.yml b/awx_collection/tests/integration/targets/project_update/tasks/main.yml index 2c9dc194b1..6859b2405a 100644 --- a/awx_collection/tests/integration/targets/project_update/tasks/main.yml +++ b/awx_collection/tests/integration/targets/project_update/tasks/main.yml @@ -22,7 +22,7 @@ - project_create_result is changed - name: Update a project without waiting - tower_project_update: + project_update: name: "{{ project_name1 }}" organization: Default wait: false @@ -33,7 +33,7 @@ - result is changed - name: Update a project and wait - tower_project_update: + project_update: name: "{{ project_name1 }}" organization: Default wait: true @@ -44,7 +44,7 @@ - result is successful - name: Update a project by ID - tower_project_update: + project_update: name: "{{ project_create_result.id }}" organization: Default wait: true diff --git a/awx_collection/tests/integration/targets/role/tasks/main.yml b/awx_collection/tests/integration/targets/role/tasks/main.yml index 03beed9659..e2805a2960 100644 --- a/awx_collection/tests/integration/targets/role/tasks/main.yml +++ b/awx_collection/tests/integration/targets/role/tasks/main.yml @@ -40,7 +40,7 @@ - project_info is changed - name: Create job templates - tower_job_template: + job_template: name: "{{ item }}" project: "{{ project_name }}" inventory: "Demo Inventory" @@ -86,7 +86,7 @@ - "result is changed" - name: Create a workflow - tower_workflow_job_template: + workflow_job_template: name: test-role-workflow organization: Default state: present @@ -139,7 +139,7 @@ register: result - name: Delete job templates - tower_job_template: + job_template: name: "{{ item }}" project: "{{ project_name }}" inventory: "Demo Inventory" diff --git a/awx_collection/tests/integration/targets/token/tasks/main.yml b/awx_collection/tests/integration/targets/token/tasks/main.yml index 739ad9b2a3..9ff781adc3 100644 --- a/awx_collection/tests/integration/targets/token/tasks/main.yml +++ b/awx_collection/tests/integration/targets/token/tasks/main.yml @@ -4,7 +4,7 @@ token_description: "AWX-Collection-tests-tower_token-description-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - name: Try to use a token as a dict which is missing the token parameter - tower_job_list: + job_list: oauthtoken: not_token: "This has no token entry" register: results @@ -16,7 +16,7 @@ - '"The provided dict in tower_oauthtoken did not properly contain the token entry" == results.msg' - name: Try to use a token as a list - tower_job_list: + job_list: oauthtoken: - dummy_token register: results @@ -62,12 +62,12 @@ register: new_token - name: Validate our token works by token - tower_job_list: + job_list: tower_oauthtoken: "{{ tower_token.token }}" register: job_list - name: Validate out token works by object - tower_job_list: + job_list: tower_oauthtoken: "{{ tower_token }}" register: job_list diff --git a/awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml b/awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml index 5808bdbba4..b0c7311c79 100644 --- a/awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml +++ b/awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml @@ -37,7 +37,7 @@ - "result is changed" - name: Add email notification - tower_notification_template: + notification_template: name: "{{ email_not }}" organization: Default notification_type: email @@ -53,7 +53,7 @@ state: present - name: Add webhook notification - tower_notification_template: + notification_template: name: "{{ webhook_not }}" organization: Default notification_type: webhook @@ -92,7 +92,7 @@ name: "{{ project_inv }}" - name: Create a source inventory - tower_inventory_source: + inventory_source: name: "{{ project_inv_source }}" description: Source for Test inventory inventory: "{{ project_inv }}" @@ -107,7 +107,7 @@ - "result is changed" - name: Create a Job Template - tower_job_template: + job_template: name: "{{ jt1_name }}" project: "{{ demo_project_name }}" inventory: Demo Inventory @@ -121,7 +121,7 @@ - "result is changed" - name: Create a second Job Template - tower_job_template: + job_template: name: "{{ jt2_name }}" project: "{{ demo_project_name }}" inventory: Demo Inventory @@ -135,7 +135,7 @@ - "result is changed" - name: Add a Survey to second Job Template - tower_job_template: + job_template: name: "{{ jt2_name }}" organization: Default project: "{{ demo_project_name }}" @@ -152,7 +152,7 @@ - "result is changed" - name: Create a workflow job template - tower_workflow_job_template: + workflow_job_template: name: "{{ wfjt_name }}" organization: Default inventory: Demo Inventory @@ -168,19 +168,19 @@ # Node actions do what this schema command used to do # schema: [{"success": [{"job_template": "{{ jt1_name }}"}], "job_template": "{{ jt2_name }}"}] - name: Create leaf node - tower_workflow_job_template_node: + workflow_job_template_node: identifier: leaf unified_job_template: "{{ jt2_name }}" workflow: "{{ wfjt_name }}" - name: Create root node - tower_workflow_job_template_node: + workflow_job_template_node: identifier: root unified_job_template: "{{ jt1_name }}" workflow: "{{ wfjt_name }}" - name: Fail if no name is set for approval - tower_workflow_job_template_node: + workflow_job_template_node: identifier: approval_test approval_node: description: "{{ approval_node_name }}" @@ -193,7 +193,7 @@ - "no_name_results.msg == 'Approval node name is required to create approval node.'" - name: Fail if absent and no identifier set - tower_workflow_job_template_node: + workflow_job_template_node: approval_node: description: "{{ approval_node_name }}" workflow: "{{ wfjt_name }}" @@ -206,7 +206,7 @@ - "no_identifier_results.msg == 'missing required arguments: identifier'" - name: Fail if present and no unified job template set - tower_workflow_job_template_node: + workflow_job_template_node: identifier: approval_test workflow: "{{ wfjt_name }}" register: no_unified_results @@ -217,7 +217,7 @@ - "no_unified_results.msg == 'state is present but any of the following are missing: unified_job_template, approval_node, success_nodes, always_nodes, failure_nodes'" - name: Create approval node - tower_workflow_job_template_node: + workflow_job_template_node: identifier: approval_test approval_node: name: "{{ approval_node_name }}" @@ -225,7 +225,7 @@ workflow: "{{ wfjt_name }}" - name: Create link for root node - tower_workflow_job_template_node: + workflow_job_template_node: identifier: root workflow: "{{ wfjt_name }}" success_nodes: @@ -234,7 +234,7 @@ - leaf - name: Delete approval node - tower_workflow_job_template_node: + workflow_job_template_node: identifier: approval_test approval_node: name: "{{ approval_node_name }}" @@ -242,7 +242,7 @@ workflow: "{{ wfjt_name }}" - name: Add started notifications to workflow job template - tower_workflow_job_template: + workflow_job_template: name: "{{ wfjt_name }}" notification_templates_started: - "{{ email_not }}" @@ -254,7 +254,7 @@ - "result is changed" - name: Re Add started notifications to workflow job template - tower_workflow_job_template: + workflow_job_template: name: "{{ wfjt_name }}" notification_templates_started: - "{{ email_not }}" @@ -266,7 +266,7 @@ - "result is not changed" - name: Add success notifications to workflow job template - tower_workflow_job_template: + workflow_job_template: name: "{{ wfjt_name }}" notification_templates_success: - "{{ email_not }}" @@ -278,7 +278,7 @@ - "result is changed" - name: Copy a workflow job template - tower_workflow_job_template: + workflow_job_template: name: "copy_{{ wfjt_name }}" copy_from: "{{ wfjt_name }}" organization: Default @@ -289,7 +289,7 @@ - result.copied - name: Fail Remove "on start" webhook notification from copied workflow job template - tower_workflow_job_template: + workflow_job_template: name: "copy_{{ wfjt_name }}" notification_templates_started: - "{{ email_not }}123" @@ -303,7 +303,7 @@ - "'returned 0 items' in remove_copied_workflow_node.msg" - name: Remove "on start" webhook notification from copied workflow job template - tower_workflow_job_template: + workflow_job_template: name: "copy_{{ wfjt_name }}" notification_templates_started: - "{{ email_not }}" @@ -314,7 +314,7 @@ - "result is changed" - name: Add Survey to Copied workflow job template - tower_workflow_job_template: + workflow_job_template: name: "copy_{{ wfjt_name }}" organization: Default survey_spec: @@ -373,7 +373,7 @@ - "result is changed" - name: Re add survey to workflow job template expected not changed. - tower_workflow_job_template: + workflow_job_template: name: "copy_{{ wfjt_name }}" organization: Default survey_spec: @@ -432,7 +432,7 @@ - "result is not changed" - name: Delete copied workflow job template - tower_workflow_job_template: + workflow_job_template: name: "copy_{{ wfjt_name }}" state: absent register: result @@ -442,7 +442,7 @@ - "result is changed" - name: Remove "on start" webhook notification from workflow job template - tower_workflow_job_template: + workflow_job_template: name: "{{ wfjt_name }}" notification_templates_started: - "{{ email_not }}" @@ -453,7 +453,7 @@ - "result is changed" - name: Delete a workflow job template with an invalid inventory and webook_credential - tower_workflow_job_template: + workflow_job_template: name: "{{ wfjt_name }}" inventory: "Does Not Exist" webhook_credential: "Does Not Exist" @@ -465,7 +465,7 @@ - "result is changed" - name: Check module fails with correct msg - tower_workflow_job_template: + workflow_job_template: name: "{{ wfjt_name }}" organization: Non_Existing_Organization register: result @@ -479,7 +479,7 @@ - "result.total_results == 0" - name: Create a workflow job template with schema in template - awx.awx.tower_workflow_job_template: + awx.awx.workflow_job_template: name: "{{ wfjt_name }}" inventory: Demo Inventory extra_vars: {'foo': 'bar', 'another-foo': {'barz': 'bar2'}} @@ -524,7 +524,7 @@ - "result is changed" - name: Kick off a workflow and wait for it - tower_workflow_launch: + workflow_launch: workflow_template: "{{ wfjt_name }}" ignore_errors: true register: result @@ -535,7 +535,7 @@ - "'id' in result['job_info']" - name: Destroy previous schema for one that fails - awx.awx.tower_workflow_job_template: + awx.awx.workflow_job_template: name: "{{ wfjt_name }}" destroy_current_schema: true schema: @@ -559,7 +559,7 @@ register: result - name: Kick off a workflow and wait for it - tower_workflow_launch: + workflow_launch: workflow_template: "{{ wfjt_name }}" ignore_errors: true register: result @@ -569,7 +569,7 @@ - result is failed - name: Delete a workflow job template - awx.awx.tower_workflow_job_template: + awx.awx.workflow_job_template: name: "{{ wfjt_name }}" state: absent register: result @@ -579,7 +579,7 @@ - "result is changed" - name: Delete the Job Template - tower_job_template: + job_template: name: "{{ jt1_name }}" project: "{{ demo_project_name }}" inventory: Demo Inventory @@ -593,7 +593,7 @@ - "result is changed" - name: Delete the second Job Template - tower_job_template: + job_template: name: "{{ jt2_name }}" project: "{{ demo_project_name }}" inventory: Demo Inventory @@ -607,7 +607,7 @@ - "result is changed" - name: Delete the inventory source - tower_inventory_source: + inventory_source: name: "{{ project_inv_source }}" inventory: "{{ project_inv }}" source: scm @@ -655,13 +655,13 @@ - "result is changed" - name: Delete email notification - tower_notification_template: + notification_template: name: "{{ email_not }}" organization: Default state: absent - name: Delete webhook notification - tower_notification_template: + notification_template: name: "{{ webhook_not }}" organization: Default state: absent diff --git a/awx_collection/tests/integration/targets/workflow_launch/tasks/main.yml b/awx_collection/tests/integration/targets/workflow_launch/tasks/main.yml index ba75c7ccf0..7efdaa9332 100644 --- a/awx_collection/tests/integration/targets/workflow_launch/tasks/main.yml +++ b/awx_collection/tests/integration/targets/workflow_launch/tasks/main.yml @@ -13,19 +13,19 @@ - block: - name: Create our workflow - tower_workflow_job_template: + workflow_job_template: name: "{{ wfjt_name1 }}" state: present - name: Add a node - tower_workflow_job_template_node: + workflow_job_template_node: workflow_job_template: "{{ wfjt_name1 }}" unified_job_template: "Demo Job Template" identifier: leaf register: new_node - name: Connect to Tower server but request an invalid workflow - tower_workflow_launch: + workflow_launch: workflow_template: "Does Not Exist" ignore_errors: true register: result @@ -36,7 +36,7 @@ - "'Unable to find workflow job template' in result.msg" - name: Run the workflow without waiting (this should just give us back a job ID) - tower_workflow_launch: + workflow_launch: workflow_template: "{{ wfjt_name1 }}" wait: false ignore_errors: true @@ -48,7 +48,7 @@ - "'id' in result['job_info']" - name: Kick off a workflow and wait for it, but only for a second - tower_workflow_launch: + workflow_launch: workflow_template: "{{ wfjt_name1 }}" timeout: 1 ignore_errors: true @@ -60,7 +60,7 @@ - "'Monitoring of Workflow Job - {{ wfjt_name1 }} aborted due to timeout' in result.msg" - name: Kick off a workflow and wait for it - tower_workflow_launch: + workflow_launch: workflow_template: "{{ wfjt_name1 }}" ignore_errors: true register: result @@ -71,7 +71,7 @@ - "'id' in result['job_info']" - name: Kick off a workflow with extra_vars but not enabled - tower_workflow_launch: + workflow_launch: workflow_template: "{{ wfjt_name1 }}" extra_vars: var1: My First Variable @@ -85,7 +85,7 @@ - "'The field extra_vars was specified but the workflow job template does not allow for it to be overridden' in result.errors" - name: Prompt the workflow's with survey - tower_workflow_job_template: + workflow_job_template: name: "{{ wfjt_name1 }}" state: present survey_enabled: true @@ -118,7 +118,7 @@ new_question: true - name: Kick off a workflow with survey - tower_workflow_launch: + workflow_launch: workflow_template: "{{ wfjt_name1 }}" extra_vars: basic_name: My First Variable @@ -131,13 +131,13 @@ - result is not failed - name: Prompt the workflow's extra_vars on launch - tower_workflow_job_template: + workflow_job_template: name: "{{ wfjt_name1 }}" state: present ask_variables_on_launch: true - name: Kick off a workflow with extra_vars - tower_workflow_launch: + workflow_launch: workflow_template: "{{ wfjt_name1 }}" extra_vars: basic_name: My First Variable @@ -151,7 +151,7 @@ - result is not failed - name: Test waiting for an approval node that doesn't exit on the last workflow for failure. - tower_workflow_approval: + workflow_approval: workflow_job_id: "{{ result.id }}" name: Test workflow approval interval: 1 @@ -166,19 +166,19 @@ - "'Monitoring of Workflow Approval - Test workflow approval aborted due to timeout' in result.msg" - name: Create new Workflow - tower_workflow_job_template: + workflow_job_template: name: "{{ wfjt_name2 }}" state: present - name: Add a job node - tower_workflow_job_template_node: + workflow_job_template_node: workflow_job_template: "{{ wfjt_name2 }}" unified_job_template: "Demo Job Template" identifier: leaf # Test tower_workflow_approval and tower_workflow_node_wait - name: Create approval node - tower_workflow_job_template_node: + workflow_job_template_node: identifier: approval_test approval_node: name: "{{ approval_node_name }}" @@ -186,21 +186,21 @@ workflow: "{{ wfjt_name2 }}" - name: Create link for approval node - tower_workflow_job_template_node: + workflow_job_template_node: identifier: approval_test workflow: "{{ wfjt_name2 }}" always_nodes: - leaf - name: Run the workflow without waiting This should pause waiting for approval - tower_workflow_launch: + workflow_launch: workflow_template: "{{ wfjt_name2 }}" wait: false ignore_errors: true register: wfjt_info - name: Wait for Job node wait to fail as it is waiting on approval - awx.awx.tower_workflow_node_wait: + awx.awx.workflow_node_wait: workflow_job_id: "{{ wfjt_info.id }}" name: Demo Job Template interval: 1 @@ -214,7 +214,7 @@ - "'Monitoring of Workflow Node - Demo Job Template aborted due to timeout' in result.msg" - name: Wait for approval node to activate and approve - awx.awx.tower_workflow_approval: + awx.awx.workflow_approval: workflow_job_id: "{{ wfjt_info.id }}" name: "{{ approval_node_name }}" interval: 1 @@ -228,14 +228,14 @@ - result is changed - name: Wait for workflow job to finish max 120s - tower_job_wait: + job_wait: job_id: "{{ wfjt_info.id }}" timeout: 120 job_type: "workflow_jobs" always: - name: Clean up test workflow - tower_workflow_job_template: + workflow_job_template: name: "{{ item }}" state: absent with_items: diff --git a/awx_collection/tools/roles/generate/templates/module.j2 b/awx_collection/tools/roles/generate/templates/module.j2 index 60e65cf92c..ea7b954053 100644 --- a/awx_collection/tools/roles/generate/templates/module.j2 +++ b/awx_collection/tools/roles/generate/templates/module.j2 @@ -96,7 +96,7 @@ EXAMPLES = ''' {% endif %} ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -142,7 +142,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters {% for option in item['json']['actions']['POST'] %} From 6911a59f39e4639763e002c799a0abffd362eac7 Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Thu, 29 Apr 2021 12:49:31 -0400 Subject: [PATCH 04/31] fix unit tests --- awx_collection/test/awx/test_completeness.py | 3 ++- awx_collection/test/awx/test_module_utils.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/awx_collection/test/awx/test_completeness.py b/awx_collection/test/awx/test_completeness.py index 553c61b88a..dcfe95f48f 100644 --- a/awx_collection/test/awx/test_completeness.py +++ b/awx_collection/test/awx/test_completeness.py @@ -169,7 +169,8 @@ def test_completeness(collection_import, request, admin_user, job_template, exec for root, dirs, files in os.walk(module_directory): if root == module_directory: for filename in files: - if re.match('^tower_.*.py$', filename): + # must begin with a letter a-z, and end in .py + if re.match('^[a-z].*\.py$', filename): module_name = filename[:-3] option_comparison[module_name] = { 'endpoint': 'N/A', diff --git a/awx_collection/test/awx/test_module_utils.py b/awx_collection/test/awx/test_module_utils.py index c80c526635..e261a74251 100644 --- a/awx_collection/test/awx/test_module_utils.py +++ b/awx_collection/test/awx/test_module_utils.py @@ -10,7 +10,7 @@ from requests.models import Response from unittest import mock awx_name = 'AWX' -tower_name = 'Red Hat Ansible Tower' +tower_name = 'Red Hat Automation Controller' ping_version = '1.2.3' From ef56571772e462b206e8f592627b3dbe7430fe14 Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Fri, 30 Apr 2021 15:41:01 -0400 Subject: [PATCH 05/31] controller_meta, templating --- awx_collection/README.md | 49 ++----------------- awx_collection/galaxy.yml | 4 +- awx_collection/meta/runtime.yml | 2 +- .../modules/{meta.py => controller_meta.py} | 6 +-- awx_collection/test/awx/test_completeness.py | 4 +- .../targets/lookup_api_plugin/tasks/main.yml | 2 +- .../targets/schedule_rrule/tasks/main.yml | 2 +- .../integration/targets/token/tasks/main.yml | 4 +- awx_collection/tests/sanity/ignore-2.10.txt | 28 +++++------ .../roles/template_galaxy/tasks/main.yml | 6 +-- 10 files changed, 34 insertions(+), 73 deletions(-) rename awx_collection/plugins/modules/{meta.py => controller_meta.py} (92%) diff --git a/awx_collection/README.md b/awx_collection/README.md index 0a9e47a5ab..a1a2a959d5 100644 --- a/awx_collection/README.md +++ b/awx_collection/README.md @@ -1,4 +1,4 @@ -# AWX Ansible Collection +# Tower Ansible Collection [comment]: # (*******************************************************) [comment]: # (* *) @@ -12,7 +12,7 @@ [comment]: # (* upon build of the collection *) [comment]: # (*******************************************************) -This Ansible collection allows for easy interaction with an AWX server via Ansible playbooks. +This Ansible collection allows for easy interaction with an Ansible Tower server via Ansible playbooks. This source for this collection lives in the `awx_collection` folder inside of the AWX source. @@ -22,12 +22,7 @@ doc fragment. ## Building and Installing -This collection templates the `galaxy.yml` file it uses. -Run `make build_collection` from the root folder of the AWX source tree. -This will create the `tar.gz` file inside the `awx_collection` folder -with the current AWX version, for example: `awx_collection/awx-awx-9.2.0.tar.gz`. - -Installing the `tar.gz` involves no special instructions. +This collection should be installed from [Content Hub](https://cloud.redhat.com/ansible/automation-hub/ansible/tower/) ## Running @@ -63,11 +58,9 @@ oauth_token = LEdCpKVKc4znzffcpQL5vLG8oyeku6 ## Release and Upgrade Notes -Notable releases of the `awx.awx` collection: +Notable releases of the `ansible.controller` collection: - - 7.0.0 is intended to be identical to the content prior to the migration, aside from changes necessary to function as a collection. - - 11.0.0 has no non-deprecated modules that depend on the deprecated `tower-cli` [PyPI](https://pypi.org/project/ansible-tower-cli/). - - 0.0.1-devel is the version you should see if installing from source, which is intended for development and expected to be unstable. + - 3.7.0 initial release The following notes are changes that may require changes to playbooks: @@ -96,38 +89,6 @@ The following notes are changes that may require changes to playbooks: - `tower_credential` no longer supports passing a file name to ssh_key_data. - The HipChat `notification_type` has been removed and can no longer be created using the `tower_notification_template` module. -## Running Unit Tests - -Tests to verify compatibility with the most recent AWX code are in `awx_collection/test/awx`. -These can be ran by `make test_collection` in the development container. - -To run outside of the development container, or to run against -Ansible source, set up a working environment: - -``` -mkvirtualenv my_new_venv -# may need to replace psycopg2 with psycopg2-binary in requirements/requirements.txt -pip install -r requirements/requirements.txt -r requirements/requirements_dev.txt -r requirements/requirements_git.txt -make clean-api -pip install -e -pip install -e . -pip install -e awxkit -py.test awx_collection/test/awx/ -``` - -## Running Integration Tests - -The integration tests require a virtualenv with `ansible` >= 2.9 and `awxkit`. -The collection must first be installed, which can be done using `make install_collection`. -You also need a configuration file, as described in the running section. - -Run the tests: - -``` -# ansible-test must be run from the directory in which the collection is installed -cd ~/.ansible/collections/ansible_collections/awx/awx/ -ansible-test integration -``` ## Licensing diff --git a/awx_collection/galaxy.yml b/awx_collection/galaxy.yml index 15ae9cdcbb..3a94c6a718 100644 --- a/awx_collection/galaxy.yml +++ b/awx_collection/galaxy.yml @@ -19,8 +19,8 @@ homepage: https://www.ansible.com/ issues: https://github.com/ansible/awx/issues?q=is%3Aissue+label%3Acomponent%3Aawx_collection license: - GPL-3.0-only -name: awx -namespace: awx +name: controller +namespace: ansible readme: README.md repository: https://github.com/ansible/awx tags: diff --git a/awx_collection/meta/runtime.yml b/awx_collection/meta/runtime.yml index b2a565da39..ff29c22ba7 100644 --- a/awx_collection/meta/runtime.yml +++ b/awx_collection/meta/runtime.yml @@ -75,7 +75,7 @@ plugin_routing: tower_settings: redirect: settings tower_meta: - redirect: meta + redirect: controller_meta tower_export: redirect: export tower_ad_hoc_command_cancel: diff --git a/awx_collection/plugins/modules/meta.py b/awx_collection/plugins/modules/controller_meta.py similarity index 92% rename from awx_collection/plugins/modules/meta.py rename to awx_collection/plugins/modules/controller_meta.py index dafa023a25..d0812c9753 100644 --- a/awx_collection/plugins/modules/meta.py +++ b/awx_collection/plugins/modules/controller_meta.py @@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported DOCUMENTATION = ''' --- -module: meta +module: controller_meta author: "Alan Rominger (@alancoding)" short_description: Returns metadata about the collection this module lives in. description: @@ -49,7 +49,7 @@ version: EXAMPLES = ''' -- meta: +- controller_meta: register: result - name: Show details about the collection @@ -66,7 +66,7 @@ from ..module_utils.controller_api import ControllerAPIModule def main(): module = ControllerAPIModule(argument_spec={}) - namespace = {'awx': 'awx', 'tower': 'ansible'}.get(module._COLLECTION_TYPE, 'unknown') + namespace = {'awx': 'awx', 'controller': 'ansible'}.get(module._COLLECTION_TYPE, 'unknown') namespace_name = '{0}.{1}'.format(namespace, module._COLLECTION_TYPE) module.exit_json(prefix=namespace_name, name=module._COLLECTION_TYPE, namespace=namespace, version=module._COLLECTION_VERSION) diff --git a/awx_collection/test/awx/test_completeness.py b/awx_collection/test/awx/test_completeness.py index dcfe95f48f..a2667d9cd6 100644 --- a/awx_collection/test/awx/test_completeness.py +++ b/awx_collection/test/awx/test_completeness.py @@ -25,7 +25,7 @@ no_module_for_endpoint = [] # Some modules work on the related fields of an endpoint. These modules will not have an auto-associated endpoint no_endpoint_for_module = [ 'import', - 'meta', + 'controller_meta', 'export', 'inventory_source_update', 'job_launch', @@ -170,7 +170,7 @@ def test_completeness(collection_import, request, admin_user, job_template, exec if root == module_directory: for filename in files: # must begin with a letter a-z, and end in .py - if re.match('^[a-z].*\.py$', filename): + if re.match(r'^[a-z].*.py$', filename): module_name = filename[:-3] option_comparison[module_name] = { 'endpoint': 'N/A', diff --git a/awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml b/awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml index 416ec855bd..b9be9607b0 100644 --- a/awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml +++ b/awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml @@ -16,7 +16,7 @@ group_name: "AWX-Collection-tests-tower_api_lookup-group1-{{ test_id }}" - name: Get our collection package - meta: + controller_meta: register: tower_meta - name: Generate the name of our plugin diff --git a/awx_collection/tests/integration/targets/schedule_rrule/tasks/main.yml b/awx_collection/tests/integration/targets/schedule_rrule/tasks/main.yml index 84ff069b51..f7a1b0e2b0 100644 --- a/awx_collection/tests/integration/targets/schedule_rrule/tasks/main.yml +++ b/awx_collection/tests/integration/targets/schedule_rrule/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Get our collection package - meta: + controller_meta: register: tower_meta - name: Generate the name of our plugin diff --git a/awx_collection/tests/integration/targets/token/tasks/main.yml b/awx_collection/tests/integration/targets/token/tasks/main.yml index 9ff781adc3..afbcb84768 100644 --- a/awx_collection/tests/integration/targets/token/tasks/main.yml +++ b/awx_collection/tests/integration/targets/token/tasks/main.yml @@ -5,7 +5,7 @@ - name: Try to use a token as a dict which is missing the token parameter job_list: - oauthtoken: + tower_oauthtoken: not_token: "This has no token entry" register: results ignore_errors: true @@ -17,7 +17,7 @@ - name: Try to use a token as a list job_list: - oauthtoken: + tower_oauthtoken: - dummy_token register: results ignore_errors: true diff --git a/awx_collection/tests/sanity/ignore-2.10.txt b/awx_collection/tests/sanity/ignore-2.10.txt index a0e41bd790..b990470a8d 100644 --- a/awx_collection/tests/sanity/ignore-2.10.txt +++ b/awx_collection/tests/sanity/ignore-2.10.txt @@ -1,16 +1,16 @@ -plugins/modules/tower_receive.py validate-modules:deprecation-mismatch -plugins/modules/tower_send.py validate-modules:deprecation-mismatch -plugins/modules/tower_workflow_template.py validate-modules:deprecation-mismatch -plugins/modules/tower_credential.py pylint:wrong-collection-deprecated-version-tag -plugins/modules/tower_job_wait.py pylint:wrong-collection-deprecated-version-tag -plugins/modules/tower_notification_template.py pylint:wrong-collection-deprecated-version-tag -plugins/inventory/tower.py pylint:raise-missing-from -plugins/inventory/tower.py pylint:super-with-arguments -plugins/lookup/tower_schedule_rrule.py pylint:raise-missing-from -plugins/module_utils/tower_api.py pylint:super-with-arguments -plugins/module_utils/tower_awxkit.py pylint:super-with-arguments +plugins/modules/receive.py validate-modules:deprecation-mismatch +plugins/modules/send.py validate-modules:deprecation-mismatch +plugins/modules/workflow_template.py validate-modules:deprecation-mismatch +plugins/modules/credential.py pylint:wrong-collection-deprecated-version-tag +plugins/modules/job_wait.py pylint:wrong-collection-deprecated-version-tag +plugins/modules/notification_template.py pylint:wrong-collection-deprecated-version-tag +plugins/inventory/controller.py pylint:raise-missing-from +plugins/inventory/controller.py pylint:super-with-arguments +plugins/lookup/schedule_rrule.py pylint:raise-missing-from +plugins/module_utils/controller_api.py pylint:super-with-arguments +plugins/module_utils/awxkit.py pylint:super-with-arguments plugins/module_utils/tower_legacy.py pylint:super-with-arguments -plugins/module_utils/tower_module.py pylint:super-with-arguments -plugins/module_utils/tower_module.py pylint:raise-missing-from +plugins/module_utils/controller_module.py pylint:super-with-arguments +plugins/module_utils/controller_module.py pylint:raise-missing-from test/awx/conftest.py pylint:raise-missing-from -plugins/module_utils/tower_api.py pep8:E203 +plugins/module_utils/controller_api.py pep8:E203 diff --git a/awx_collection/tools/roles/template_galaxy/tasks/main.yml b/awx_collection/tools/roles/template_galaxy/tasks/main.yml index 1b12854c0d..99f3356a47 100644 --- a/awx_collection/tools/roles/template_galaxy/tasks/main.yml +++ b/awx_collection/tools/roles/template_galaxy/tasks/main.yml @@ -24,15 +24,15 @@ with_fileglob: - "{{ collection_path }}/plugins/inventory/*.py" - "{{ collection_path }}/plugins/lookup/*.py" - - "{{ collection_path }}/plugins/modules/tower_*.py" + - "{{ collection_path }}/plugins/modules/*.py" loop_control: label: "{{ item | basename }}" - name: Change inventory file to support desired namespace and package names replace: path: "{{ collection_path }}/plugins/inventory/controller.py" - regexp: "^ NAME = 'awx.awx.tower' # REPLACE$" - replace: " NAME = '{{ collection_namespace }}.{{ collection_package }}.tower' # REPLACE" + regexp: "^ NAME = 'awx.awx.controller' # REPLACE$" + replace: " NAME = '{{ collection_namespace }}.{{ collection_package }}.controller' # REPLACE" - name: get list of test files find: From 9f4172ce7b605295800ce0c08385450e1d3a0905 Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Fri, 30 Apr 2021 15:43:42 -0400 Subject: [PATCH 06/31] upstream --- awx_collection/README.md | 49 +++++++++++++++++++++++++++++++++++---- awx_collection/galaxy.yml | 4 ++-- 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/awx_collection/README.md b/awx_collection/README.md index a1a2a959d5..0a9e47a5ab 100644 --- a/awx_collection/README.md +++ b/awx_collection/README.md @@ -1,4 +1,4 @@ -# Tower Ansible Collection +# AWX Ansible Collection [comment]: # (*******************************************************) [comment]: # (* *) @@ -12,7 +12,7 @@ [comment]: # (* upon build of the collection *) [comment]: # (*******************************************************) -This Ansible collection allows for easy interaction with an Ansible Tower server via Ansible playbooks. +This Ansible collection allows for easy interaction with an AWX server via Ansible playbooks. This source for this collection lives in the `awx_collection` folder inside of the AWX source. @@ -22,7 +22,12 @@ doc fragment. ## Building and Installing -This collection should be installed from [Content Hub](https://cloud.redhat.com/ansible/automation-hub/ansible/tower/) +This collection templates the `galaxy.yml` file it uses. +Run `make build_collection` from the root folder of the AWX source tree. +This will create the `tar.gz` file inside the `awx_collection` folder +with the current AWX version, for example: `awx_collection/awx-awx-9.2.0.tar.gz`. + +Installing the `tar.gz` involves no special instructions. ## Running @@ -58,9 +63,11 @@ oauth_token = LEdCpKVKc4znzffcpQL5vLG8oyeku6 ## Release and Upgrade Notes -Notable releases of the `ansible.controller` collection: +Notable releases of the `awx.awx` collection: - - 3.7.0 initial release + - 7.0.0 is intended to be identical to the content prior to the migration, aside from changes necessary to function as a collection. + - 11.0.0 has no non-deprecated modules that depend on the deprecated `tower-cli` [PyPI](https://pypi.org/project/ansible-tower-cli/). + - 0.0.1-devel is the version you should see if installing from source, which is intended for development and expected to be unstable. The following notes are changes that may require changes to playbooks: @@ -89,6 +96,38 @@ The following notes are changes that may require changes to playbooks: - `tower_credential` no longer supports passing a file name to ssh_key_data. - The HipChat `notification_type` has been removed and can no longer be created using the `tower_notification_template` module. +## Running Unit Tests + +Tests to verify compatibility with the most recent AWX code are in `awx_collection/test/awx`. +These can be ran by `make test_collection` in the development container. + +To run outside of the development container, or to run against +Ansible source, set up a working environment: + +``` +mkvirtualenv my_new_venv +# may need to replace psycopg2 with psycopg2-binary in requirements/requirements.txt +pip install -r requirements/requirements.txt -r requirements/requirements_dev.txt -r requirements/requirements_git.txt +make clean-api +pip install -e +pip install -e . +pip install -e awxkit +py.test awx_collection/test/awx/ +``` + +## Running Integration Tests + +The integration tests require a virtualenv with `ansible` >= 2.9 and `awxkit`. +The collection must first be installed, which can be done using `make install_collection`. +You also need a configuration file, as described in the running section. + +Run the tests: + +``` +# ansible-test must be run from the directory in which the collection is installed +cd ~/.ansible/collections/ansible_collections/awx/awx/ +ansible-test integration +``` ## Licensing diff --git a/awx_collection/galaxy.yml b/awx_collection/galaxy.yml index 3a94c6a718..15ae9cdcbb 100644 --- a/awx_collection/galaxy.yml +++ b/awx_collection/galaxy.yml @@ -19,8 +19,8 @@ homepage: https://www.ansible.com/ issues: https://github.com/ansible/awx/issues?q=is%3Aissue+label%3Acomponent%3Aawx_collection license: - GPL-3.0-only -name: controller -namespace: ansible +name: awx +namespace: awx readme: README.md repository: https://github.com/ansible/awx tags: From 82c5803e595b6443c0e1e50937f76b615e24cc70 Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Mon, 3 May 2021 17:20:24 -0400 Subject: [PATCH 07/31] mostly includes renaming non-syntax references to tower --- awx_collection/TESTING.md | 26 +++++++------- awx_collection/galaxy.yml | 2 +- awx_collection/plugins/doc_fragments/auth.py | 20 +++++------ .../plugins/doc_fragments/auth_legacy.py | 16 ++++----- .../plugins/doc_fragments/auth_plugin.py | 16 ++++----- .../plugins/inventory/controller.py | 24 ++++++------- .../plugins/lookup/controller_api.py | 14 ++++---- .../plugins/lookup/schedule_rrule.py | 10 +++--- .../plugins/module_utils/controller_api.py | 22 ++++++------ .../plugins/module_utils/tower_legacy.py | 2 +- .../plugins/modules/ad_hoc_command.py | 6 ++-- .../plugins/modules/ad_hoc_command_cancel.py | 8 ++--- .../plugins/modules/ad_hoc_command_wait.py | 8 ++--- awx_collection/plugins/modules/application.py | 4 +-- awx_collection/plugins/modules/credential.py | 20 +++++------ .../modules/credential_input_source.py | 4 +-- .../plugins/modules/credential_type.py | 10 +++--- .../plugins/modules/execution_environment.py | 6 ++-- awx_collection/plugins/modules/export.py | 8 ++--- awx_collection/plugins/modules/group.py | 12 +++---- awx_collection/plugins/modules/host.py | 6 ++-- awx_collection/plugins/modules/import.py | 8 ++--- .../plugins/modules/instance_group.py | 4 +-- awx_collection/plugins/modules/inventory.py | 8 ++--- .../plugins/modules/inventory_source.py | 6 ++-- .../modules/inventory_source_update.py | 4 +-- awx_collection/plugins/modules/job_cancel.py | 6 ++-- awx_collection/plugins/modules/job_launch.py | 8 ++--- awx_collection/plugins/modules/job_list.py | 4 +-- .../plugins/modules/job_template.py | 12 +++---- awx_collection/plugins/modules/job_wait.py | 12 +++---- awx_collection/plugins/modules/label.py | 8 ++--- awx_collection/plugins/modules/license.py | 4 +-- .../plugins/modules/notification_template.py | 4 +-- .../plugins/modules/organization.py | 10 +++--- awx_collection/plugins/modules/project.py | 12 +++---- .../plugins/modules/project_update.py | 6 ++-- awx_collection/plugins/modules/receive.py | 6 ++-- awx_collection/plugins/modules/role.py | 4 +-- awx_collection/plugins/modules/schedule.py | 6 ++-- awx_collection/plugins/modules/send.py | 6 ++-- awx_collection/plugins/modules/settings.py | 4 +-- awx_collection/plugins/modules/team.py | 6 ++-- awx_collection/plugins/modules/token.py | 10 +++--- awx_collection/plugins/modules/user.py | 12 +++---- .../plugins/modules/workflow_approval.py | 2 +- .../plugins/modules/workflow_job_template.py | 6 ++-- .../modules/workflow_job_template_node.py | 10 +++--- .../plugins/modules/workflow_launch.py | 6 ++-- .../plugins/modules/workflow_node_wait.py | 2 +- .../plugins/modules/workflow_template.py | 4 +-- awx_collection/test/awx/test_ad_hoc_wait.py | 2 +- awx_collection/test/awx/test_completeness.py | 8 ++--- awx_collection/test/awx/test_group.py | 2 +- awx_collection/test/awx/test_job.py | 2 +- awx_collection/test/awx/test_module_utils.py | 18 +++++----- .../targets/ad_hoc_command/tasks/main.yml | 6 ++-- .../ad_hoc_command_cancel/tasks/main.yml | 6 ++-- .../ad_hoc_command_wait/tasks/main.yml | 8 ++--- .../targets/application/tasks/main.yml | 6 ++-- .../targets/credential/tasks/main.yml | 34 +++++++++---------- .../credential_input_source/tasks/main.yml | 18 +++++----- .../targets/credential_type/tasks/main.yml | 2 +- .../integration/targets/export/tasks/main.yml | 8 ++--- .../integration/targets/group/tasks/main.yml | 14 ++++---- .../integration/targets/host/tasks/main.yml | 4 +-- .../integration/targets/import/tasks/main.yml | 4 +-- .../targets/instance_group/tasks/main.yml | 6 ++-- .../targets/inventory/tasks/main.yml | 8 ++--- .../targets/inventory_source/tasks/main.yml | 10 +++--- .../inventory_source_update/tasks/main.yml | 12 +++---- .../targets/job_launch/tasks/main.yml | 6 ++-- .../targets/job_template/tasks/main.yml | 22 ++++++------ .../targets/job_wait/tasks/main.yml | 12 +++---- .../integration/targets/label/tasks/main.yml | 2 +- .../targets/lookup_api_plugin/tasks/main.yml | 24 ++++++------- .../notification_template/tasks/main.yml | 12 +++---- .../targets/organization/tasks/main.yml | 4 +-- .../targets/project/tasks/main.yml | 16 ++++----- .../tasks/create_project_dir.yml | 4 +-- .../targets/project_update/tasks/main.yml | 2 +- .../integration/targets/role/tasks/main.yml | 10 +++--- .../targets/schedule/tasks/main.yml | 2 +- .../targets/schedule_rrule/tasks/main.yml | 4 +-- .../targets/settings/tasks/main.yml | 2 +- .../integration/targets/team/tasks/main.yml | 10 +++--- .../integration/targets/token/tasks/main.yml | 2 +- .../integration/targets/user/tasks/main.yml | 4 +-- .../workflow_job_template/tasks/main.yml | 26 +++++++------- .../targets/workflow_launch/tasks/main.yml | 10 +++--- .../template_galaxy/templates/galaxy.yml.j2 | 2 +- awx_collection/tools/vars/examples.yml | 20 +++++------ 92 files changed, 410 insertions(+), 408 deletions(-) diff --git a/awx_collection/TESTING.md b/awx_collection/TESTING.md index 23a01c7ad5..0ecf99c26e 100644 --- a/awx_collection/TESTING.md +++ b/awx_collection/TESTING.md @@ -7,9 +7,9 @@ When trying to fix a bug, it is best to replicate its behavior within a test wit ## Unit Tests -The unit tests are stored in the `test/awx` directory and, where possible, test interactions between the collections modules and the AWX database. This is achieved by using a Python testing suite and having a mocked layer which emulates interactions with the Tower API. You do not need a server to run these unit tests. The depth of testing is not fixed and can change from module to module. +The unit tests are stored in the `test/awx` directory and, where possible, test interactions between the collections modules and the AWX database. This is achieved by using a Python testing suite and having a mocked layer which emulates interactions with the API. You do not need a server to run these unit tests. The depth of testing is not fixed and can change from module to module. -Let's take a closer look at the `test_token.py` file (which tests the `tower_token` module): +Let's take a closer look at the `test_token.py` file (which tests the `token` module): ``` from __future__ import (absolute_import, division, print_function) @@ -43,7 +43,7 @@ def test_create_token(run_module, admin_user): assert tokens[0].scope == 'read', 'Token was not given read access' ``` -This test has a single test called `test_create_token`. It creates a `module_args` section which is what will be passed into our module. We then call `run_module`, asking it to run the `tower_token` module with the `module_args` we created and give us back the results. After that, we run an assertion to validate that our module did in fact report a change to the system. We will then use Python objects to look up the token that has a description of `barfoo` (which was in our arguments to the module). We want to validate that we only got back one token (the one we created) and that the scope of the token we created was read. +This test has a single test called `test_create_token`. It creates a `module_args` section which is what will be passed into our module. We then call `run_module`, asking it to run the `token` module with the `module_args` we created and give us back the results. After that, we run an assertion to validate that our module did in fact report a change to the system. We will then use Python objects to look up the token that has a description of `barfoo` (which was in our arguments to the module). We want to validate that we only got back one token (the one we created) and that the scope of the token we created was read. ### Completion Test @@ -70,7 +70,7 @@ Inside the `/tests` directory, there are two folders: In the `/sanity` folder are file directives for specific Ansible versions which contain information about which tests to skip for specific files. There are a number of reasons you may need to skip a sanity test. See the [`ansible-test` documentation](https://docs.ansible.com/ansible/latest/dev_guide/testing_running_locally.html) for more details about how and why you might want to skip a test. -In the `integration/targets` folder you will see directories (which act as roles) for all of the different modules and plugins. When the collection is tested, an instance of Ansible Tower (or AWX) will be spun up and these roles will be applied to the target server to validate the functionality of the modules. Since these are really roles, each directory will contain a tasks folder under it with a `main.yml` file as an entry point. +In the `integration/targets` folder you will see directories (which act as roles) for all of the different modules and plugins. When the collection is tested, an instance of Automation Platform Controller (or AWX) will be spun up and these roles will be applied to the target server to validate the functionality of the modules. Since these are really roles, each directory will contain a tasks folder under it with a `main.yml` file as an entry point. While not strictly followed, the general flow of a test should be: @@ -87,16 +87,16 @@ While not strictly followed, the general flow of a test should be: ``` - name: Generate names set_fact: - group_name1: "AWX-Collection-tests-tower_instance_group-group1-{{ test_id }}" - group_name2: "AWX-Collection-tests-tower_instance_group-group2-{{ test_id }}" - cred_name1: "AWX-Collection-tests-tower_instance_group-cred1-{{ test_id }}" + group_name1: "AWX-Collection-tests-instance_group-group1-{{ test_id }}" + group_name2: "AWX-Collection-tests-instance_group-group2-{{ test_id }}" + cred_name1: "AWX-Collection-tests-instance_group-cred1-{{ test_id }}" ``` - **Non-creating tests (i.e. test for specific error conditions, etc), with assertion** ``` - name: Try to use a token as a dict which is missing the token parameter - tower_job_list: + job_list: tower_oauthtoken: not_token: "This has no token entry" register: results @@ -112,7 +112,7 @@ While not strictly followed, the general flow of a test should be: - Run test which creates/modifies/deletes object(s) ``` - name: Create a container group - tower_instance_group: + instance_group: name: "{{ group_name2 }}" credential: "{{ cred_result.id }}" register: result @@ -135,7 +135,7 @@ While not strictly followed, the general flow of a test should be: ``` - Assert cleanup worked properly (if needed) -When writing an integration test, a test of asset type A does not need to make assertions for asset type B. For example, if you are writing an integration test for a credential and you create a custom credential type, you do not need to assert that the `tower_credential_type` call properly worked, you can assume it will. In addition, when cleaning up and deleting the `tower_credential_type`, you do not need to assert that it properly deleted the credential type. +When writing an integration test, a test of asset type A does not need to make assertions for asset type B. For example, if you are writing an integration test for a credential and you create a custom credential type, you do not need to assert that the `credential_type` call properly worked, you can assume it will. In addition, when cleaning up and deleting the `credential_type`, you do not need to assert that it properly deleted the credential type. ## Running Unit Tests @@ -176,7 +176,7 @@ FAILED awx_collection/test/awx/test_module_utils.py::test_type_warning - SystemE make: *** [Makefile:382: test_collection] Error 1 ``` -In addition to running all of the tests, you can also specify specific tests to run. This is useful when developing a single module. In this example, we will run the tests for the `tower_token` module: +In addition to running all of the tests, you can also specify specific tests to run. This is useful when developing a single module. In this example, we will run the tests for the `token` module: ``` $ pytest awx_collection/test/awx/test_token.py @@ -195,7 +195,7 @@ awx_collection/test/awx/test_token.py . [100%] ## Running Integration Tests -For integration tests, you will need an existing AWX or Ansible Tower instance to run the test playbooks against. You can write a simple `run_it.yml` playbook to invoke the main method: +For integration tests, you will need an existing AWX or Automation Platform Controller instance to run the test playbooks against. You can write a simple `run_it.yml` playbook to invoke the main method: ``` --- @@ -215,7 +215,7 @@ For integration tests, you will need an existing AWX or Ansible Tower instance t - include_tasks: main.yml ``` -Place this file in the `/tasks` directory of the test playbook you'd like to run (i.e., `awx/awx_collection/tests/integration/targets/tower_ad_hoc_command_cancel/tasks/`; a test playbook named `main.yml` must be in the same directory). +Place this file in the `/tasks` directory of the test playbook you'd like to run (i.e., `awx/awx_collection/tests/integration/targets/ad_hoc_command_cancel/tasks/`; a test playbook named `main.yml` must be in the same directory). The `run_it.yml` playbook will set up your connection parameters via environment variables and then invoke the `main.yml` play of the role. diff --git a/awx_collection/galaxy.yml b/awx_collection/galaxy.yml index 15ae9cdcbb..b995bfe3e8 100644 --- a/awx_collection/galaxy.yml +++ b/awx_collection/galaxy.yml @@ -13,7 +13,7 @@ authors: - AWX Project Contributors dependencies: {} -description: Ansible content that interacts with the AWX or Ansible Tower API. +description: Ansible content that interacts with the AWX or Automation Platform Controller API. documentation: https://github.com/ansible/awx/blob/devel/awx_collection/README.md homepage: https://www.ansible.com/ issues: https://github.com/ansible/awx/issues?q=is%3Aissue+label%3Acomponent%3Aawx_collection diff --git a/awx_collection/plugins/doc_fragments/auth.py b/awx_collection/plugins/doc_fragments/auth.py index cc8d449bad..90869d1159 100644 --- a/awx_collection/plugins/doc_fragments/auth.py +++ b/awx_collection/plugins/doc_fragments/auth.py @@ -10,37 +10,37 @@ __metaclass__ = type class ModuleDocFragment(object): - # Ansible Tower documentation fragment + # Automation Platform Controller documentation fragment DOCUMENTATION = r''' options: tower_host: description: - - URL to your Tower or AWX instance. + - URL to your Automation Platform Controller instance. - If value not set, will try environment variable C(TOWER_HOST) and then config files - If value not specified by any means, the value of C(127.0.0.1) will be used type: str tower_username: description: - - Username for your Tower or AWX instance. + - Username for your controller instance. - If value not set, will try environment variable C(TOWER_USERNAME) and then config files type: str tower_password: description: - - Password for your Tower or AWX instance. + - Password for your controller instance. - If value not set, will try environment variable C(TOWER_PASSWORD) and then config files type: str tower_oauthtoken: description: - - The Tower OAuth token to use. + - The OAuth token to use. - This value can be in one of two formats. - A string which is the token itself. (i.e. bqV5txm97wqJqtkxlMkhQz0pKhRMMX) - - A dictionary structure as returned by the tower_token module. + - A dictionary structure as returned by the token module. - If value not set, will try environment variable C(TOWER_OAUTH_TOKEN) and then config files type: raw version_added: "3.7" validate_certs: description: - - Whether to allow insecure connections to Tower or AWX. + - Whether to allow insecure connections to AWX. - If C(no), SSL certificates will not be validated. - This should only be used on personally controlled sites using self-signed certificates. - If value not set, will try environment variable C(TOWER_VERIFY_SSL) and then config files @@ -48,14 +48,14 @@ options: aliases: [ tower_verify_ssl ] tower_config_file: description: - - Path to the Tower or AWX config file. + - Path to the controller config file. - If provided, the other locations for config files will not be considered. type: path notes: - If no I(config_file) is provided we will attempt to use the tower-cli library - defaults to find your Tower host information. -- I(config_file) should contain Tower configuration in the following format + defaults to find your host information. +- I(config_file) should be in the following format host=hostname username=username password=password diff --git a/awx_collection/plugins/doc_fragments/auth_legacy.py b/awx_collection/plugins/doc_fragments/auth_legacy.py index dcece09976..9ce9aab82b 100644 --- a/awx_collection/plugins/doc_fragments/auth_legacy.py +++ b/awx_collection/plugins/doc_fragments/auth_legacy.py @@ -10,28 +10,28 @@ __metaclass__ = type class ModuleDocFragment(object): - # Automation Controller documentation fragment + # Automation Platform Controller documentation fragment DOCUMENTATION = r''' options: tower_host: description: - - URL to your Tower or AWX instance. + - URL to your Automation Platform Controller instance. - If value not set, will try environment variable C(TOWER_HOST) and then config files - If value not specified by any means, the value of C(127.0.0.1) will be used type: str tower_username: description: - - Username for your Tower or AWX instance. + - Username for your controller instance. - If value not set, will try environment variable C(TOWER_USERNAME) and then config files type: str tower_password: description: - - Password for your Tower or AWX instance. + - Password for your controller instance. - If value not set, will try environment variable C(TOWER_PASSWORD) and then config files type: str validate_certs: description: - - Whether to allow insecure connections to Tower or AWX. + - Whether to allow insecure connections. - If C(no), SSL certificates will not be validated. - This should only be used on personally controlled sites using self-signed certificates. - If value not set, will try environment variable C(TOWER_VERIFY_SSL) and then config files @@ -39,14 +39,14 @@ options: aliases: [ tower_verify_ssl ] tower_config_file: description: - - Path to the Tower or AWX config file. + - Path to the controller config file. - If provided, the other locations for config files will not be considered. type: path notes: - If no I(config_file) is provided we will attempt to use the tower-cli library - defaults to find your Tower host information. -- I(config_file) should contain Tower configuration in the following format + defaults to find your host information. +- I(config_file) should be in the following format host=hostname username=username password=password diff --git a/awx_collection/plugins/doc_fragments/auth_plugin.py b/awx_collection/plugins/doc_fragments/auth_plugin.py index 207100c193..06214bdcc6 100644 --- a/awx_collection/plugins/doc_fragments/auth_plugin.py +++ b/awx_collection/plugins/doc_fragments/auth_plugin.py @@ -10,29 +10,29 @@ __metaclass__ = type class ModuleDocFragment(object): - # Automation Controller documentation fragment + # Automation Platform Controller documentation fragment DOCUMENTATION = r''' options: host: - description: The network address of your Automation Controller host. + description: The network address of your Automation Platform Controller host. env: - name: TOWER_HOST username: - description: The user that you plan to use to access inventories on Automation Controller. + description: The user that you plan to use to access inventories on the controller. env: - name: TOWER_USERNAME password: - description: The password for your Automation Controller user. + description: The password for your controller user. env: - name: TOWER_PASSWORD oauth_token: description: - - The Tower OAuth token to use. + - The OAuth token to use. env: - name: TOWER_OAUTH_TOKEN verify_ssl: description: - - Specify whether Ansible should verify the SSL certificate of Automation Controller host. + - Specify whether Ansible should verify the SSL certificate of the controller host. - Defaults to True, but this is handled by the shared module_utils code type: bool env: @@ -41,8 +41,8 @@ options: notes: - If no I(config_file) is provided we will attempt to use the tower-cli library - defaults to find your Tower host information. -- I(config_file) should contain Tower configuration in the following format + defaults to find your host information. +- I(config_file) should be in the following format host=hostname username=username password=password diff --git a/awx_collection/plugins/inventory/controller.py b/awx_collection/plugins/inventory/controller.py index 1272d1b587..c3d24cd810 100644 --- a/awx_collection/plugins/inventory/controller.py +++ b/awx_collection/plugins/inventory/controller.py @@ -6,14 +6,14 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type DOCUMENTATION = ''' -name: tower +name: controller plugin_type: inventory author: - Matthew Jones (@matburt) - Yunfan Zhang (@YunfanZhang42) -short_description: Ansible dynamic inventory plugin for Automation Controller. +short_description: Ansible dynamic inventory plugin for the Automation Platform Controller. description: - - Reads inventories from Automation Controller. + - Reads inventories from the Automation Platform Controller. - Supports reading configuration from both YAML config file and environment variables. - If reading from the YAML file, the file name must end with tower.(yml|yaml) or tower_inventory.(yml|yaml), the path in the command would be /path/to/tower_inventory.(yml|yaml). If some arguments in the config file @@ -23,7 +23,7 @@ extends_documentation_fragment: awx.awx.auth_plugin options: inventory_id: description: - - The ID of the Automation Controller inventory that you wish to import. + - The ID of the inventory that you wish to import. - This is allowed to be either the inventory primary key or its named URL slug. - Primary key values will be accepted as strings or integers, and URL slugs must be strings. - Named URL slugs follow the syntax of "inventory_name++organization_name". @@ -32,7 +32,7 @@ options: - name: TOWER_INVENTORY required: True include_metadata: - description: Make extra requests to provide all group vars with metadata about the source Automation Controller host. + description: Make extra requests to provide all group vars with metadata about the source host. type: bool default: False ''' @@ -43,11 +43,11 @@ EXAMPLES = ''' # Example for using tower_inventory.yml file -plugin: awx.awx.tower -host: your_ansible_tower_server_network_address -username: your_ansible_tower_username -password: your_ansible_tower_password -inventory_id: the_ID_of_targeted_ansible_tower_inventory +plugin: awx.awx.controller +host: your_automation_controller_server_network_address +username: your_automation_controller_username +password: your_automation_controller_password +inventory_id: the_ID_of_targeted_automation_controller_inventory # Then you can run the following command. # If some of the arguments are missing, Ansible will attempt to read them from environment variables. # ansible-inventory -i /path/to/tower_inventory.yml --list @@ -59,7 +59,7 @@ inventory_id: the_ID_of_targeted_ansible_tower_inventory # export TOWER_USERNAME=YOUR_TOWER_USERNAME # export TOWER_PASSWORD=YOUR_TOWER_PASSWORD # export TOWER_INVENTORY=THE_ID_OF_TARGETED_INVENTORY -# Read the inventory specified in TOWER_INVENTORY from Automation Controller, and list them. +# Read the inventory specified in TOWER_INVENTORY from the controller, and list them. # The inventory path must always be @tower_inventory if you are reading all settings from environment variables. # ansible-inventory -i @tower_inventory --list ''' @@ -80,7 +80,7 @@ def handle_error(**kwargs): class InventoryModule(BaseInventoryPlugin): - NAME = 'awx.awx.tower' # REPLACE + NAME = 'awx.awx.controller' # REPLACE # Stays backward compatible with tower inventory script. # If the user supplies '@tower_inventory' as path, the plugin will read from environment variables. no_config_file_supplied = False diff --git a/awx_collection/plugins/lookup/controller_api.py b/awx_collection/plugins/lookup/controller_api.py index 51657755b4..90dcaebfdf 100644 --- a/awx_collection/plugins/lookup/controller_api.py +++ b/awx_collection/plugins/lookup/controller_api.py @@ -11,10 +11,10 @@ short_description: Search the API for objects requirements: - None description: - - Returns GET requests from the Automation Controller API. See + - Returns GET requests from the Automation Platform Controller API. See U(https://docs.ansible.com/ansible-tower/latest/html/towerapi/index.html) for API usage. - - For use that is cross-compatible between the awx.awx and ansible.tower collection - see the tower_meta module + - For use that is cross-compatible between the awx.awx and ansible.controller collection + see the controller_meta module extends_documentation_fragment: awx.awx.auth_plugin options: _terms: @@ -71,11 +71,11 @@ notes: EXAMPLES = """ - name: Load the UI settings set_fact: - tower_settings: "{{ lookup('awx.awx.controller_api', 'settings/ui') }}" + controller_settings: "{{ lookup('awx.awx.controller_api', 'settings/ui') }}" - name: Load the UI settings specifying the connection info set_fact: - tower_settings: "{{ lookup('awx.awx.controller_api', 'settings/ui' host='tower.example.com', username='admin', password=my_pass_var, verify_ssl=False) }}" + controller_settings: "{{ lookup('awx.awx.controller_api', 'settings/ui' host='tower.example.com', username='admin', password=my_pass_var, verify_ssl=False) }}" - name: Report the usernames of all users with admin privs debug: @@ -89,14 +89,14 @@ EXAMPLES = """ label: "{{ item['name'] }}" - name: Make sure user 'john' is an org admin of the default org if the user exists - tower_role: + role: organization: Default role: admin user: john when: "lookup('awx.awx.controller_api', 'users', query_params={ 'username': 'john' }) | length == 1" - name: Create an inventory group with all 'foo' hosts - tower_group: + group: name: "Foo Group" inventory: "Demo Inventory" hosts: >- diff --git a/awx_collection/plugins/lookup/schedule_rrule.py b/awx_collection/plugins/lookup/schedule_rrule.py index 9876be153b..4b5dd7fe73 100644 --- a/awx_collection/plugins/lookup/schedule_rrule.py +++ b/awx_collection/plugins/lookup/schedule_rrule.py @@ -5,9 +5,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type DOCUMENTATION = """ - lookup: tower_schedule_rrule + lookup: schedule_rrule author: John Westcott IV (@john-westcott-iv) - short_description: Generate an rrule string which can be used for Tower Schedules + short_description: Generate an rrule string which can be used for Schedules requirements: - pytz - python.dateutil >= 2.7.0 @@ -75,7 +75,7 @@ DOCUMENTATION = """ EXAMPLES = """ - name: Create a string for a schedule debug: - msg: "{{ query('awx.awx.tower_schedule_rrule', 'none', start_date='1979-09-13 03:45:07') }}" + msg: "{{ query('awx.awx.schedule_rrule', 'none', start_date='1979-09-13 03:45:07') }}" """ RETURN = """ @@ -233,7 +233,7 @@ class LookupModule(LookupBase): my_rule = rrule.rrule(**rrule_kwargs) - # All frequencies can use a timezone but rrule can't support the format that Tower uses. + # All frequencies can use a timezone but rrule can't support the format that AWX uses. # So we will do a string manip here if we need to timezone = 'America/New_York' if 'timezone' in kwargs: @@ -243,7 +243,7 @@ class LookupModule(LookupBase): # rrule puts a \n in the rule instad of a space and can't handle timezones return_rrule = str(my_rule).replace('\n', ' ').replace('DTSTART:', 'DTSTART;TZID={0}:'.format(timezone)) - # Tower requires an interval. rrule will not add interval if it's set to 1 + # AWX requires an interval. rrule will not add interval if it's set to 1 if kwargs.get('every', 1) == 1: return_rrule = "{0};INTERVAL=1".format(return_rrule) diff --git a/awx_collection/plugins/module_utils/controller_api.py b/awx_collection/plugins/module_utils/controller_api.py index 4a5de0f55e..b655c261da 100644 --- a/awx_collection/plugins/module_utils/controller_api.py +++ b/awx_collection/plugins/module_utils/controller_api.py @@ -21,7 +21,7 @@ class ControllerAPIModule(ControllerModule): # Those values can be found in awx/api/generics.py line 204 collection_to_version = { 'awx': 'AWX', - 'tower': 'Red Hat Automation Controller', + 'controller': 'Red Hat Automation Platform Controller', } session = None IDENTITY_FIELDS = {'users': 'username', 'workflow_job_template_nodes': 'identifier', 'instances': 'hostname'} @@ -190,7 +190,7 @@ class ControllerAPIModule(ControllerModule): # Extract the headers, this will be used in a couple of places headers = kwargs.get('headers', {}) - # Authenticate to Tower (if we don't have a token and if not already done so) + # Authenticate to AWX (if we don't have a token and if not already done so) if not self.oauth_token and not self.authenticated: # This method will set a cookie in the cookie jar for us and also an oauth_token self.authenticate(**kwargs) @@ -218,7 +218,7 @@ class ControllerAPIModule(ControllerModule): self.fail_json(msg='The host sent back a server error ({1}): {0}. Please check the logs and try again later'.format(url.path, he)) # Sanity check: Did we fail to authenticate properly? If so, fail out now; this is always a failure. elif he.code == 401: - self.fail_json(msg='Invalid Tower authentication credentials for {0} (HTTP 401).'.format(url.path)) + self.fail_json(msg='Invalid authentication credentials for {0} (HTTP 401).'.format(url.path)) # Sanity check: Did we get a forbidden response, which means that the user isn't allowed to do this? Report that. elif he.code == 403: self.fail_json(msg="You don't have permission to {1} to {0} (HTTP 403).".format(url.path, method)) @@ -232,7 +232,7 @@ class ControllerAPIModule(ControllerModule): # A 405 means we used a method that isn't allowed. Usually this is a bad request, but it requires special treatment because the # API sends it as a logic error in a few situations (e.g. trying to cancel a job that isn't running). elif he.code == 405: - self.fail_json(msg="The Tower server says you can't make a request with the {0} method to this endpoint {1}".format(method, url.path)) + self.fail_json(msg="Cannot make a request with the {0} method to this endpoint {1}".format(method, url.path)) # Sanity check: Did we get some other kind of error? If so, write an appropriate error message. elif he.code >= 400: # We are going to return a 400 so the module can decide what to do with it @@ -302,7 +302,7 @@ class ControllerAPIModule(ControllerModule): # Attempt to get a token from /api/v2/tokens/ by giving it our username/password combo # If we have a username and password, we need to get a session cookie login_data = { - "description": "Automation Controller Module Token", + "description": "Automation Platform Controller Module Token", "application": None, "scope": "write", } @@ -349,8 +349,8 @@ class ControllerAPIModule(ControllerModule): # the on_delete parameter will be called as a method pasing in this object and the json from the response # This will return one of two things: # 1. None if the existing_item is not defined (so no delete needs to happen) - # 2. The response from Tower from calling the delete on the endpont. It's up to you to process the response and exit from the module - # Note: common error codes from the Tower API can cause the module to fail + # 2. The response from AWX from calling the delete on the endpont. It's up to you to process the response and exit from the module + # Note: common error codes from the AWX API can cause the module to fail if existing_item: # If we have an item, we can try to delete it try: @@ -472,8 +472,8 @@ class ControllerAPIModule(ControllerModule): # the on_create parameter will be called as a method pasing in this object and the json from the response # This will return one of two things: # 1. None if the existing_item is already defined (so no create needs to happen) - # 2. The response from Tower from calling the patch on the endpont. It's up to you to process the response and exit from the module - # Note: common error codes from the Tower API can cause the module to fail + # 2. The response from AWX from calling the patch on the endpont. It's up to you to process the response and exit from the module + # Note: common error codes from the AWX API can cause the module to fail response = None if not endpoint: self.fail_json(msg="Unable to create new {0} due to missing endpoint".format(item_type)) @@ -595,8 +595,8 @@ class ControllerAPIModule(ControllerModule): # the on_update parameter will be called as a method pasing in this object and the json from the response # This will return one of two things: # 1. None if the existing_item does not need to be updated - # 2. The response from Tower from patching to the endpoint. It's up to you to process the response and exit from the module. - # Note: common error codes from the Tower API can cause the module to fail + # 2. The response from AWX from patching to the endpoint. It's up to you to process the response and exit from the module. + # Note: common error codes from the AWX API can cause the module to fail response = None if existing_item: diff --git a/awx_collection/plugins/module_utils/tower_legacy.py b/awx_collection/plugins/module_utils/tower_legacy.py index 9e92e6429b..e184ac0f05 100644 --- a/awx_collection/plugins/module_utils/tower_legacy.py +++ b/awx_collection/plugins/module_utils/tower_legacy.py @@ -83,7 +83,7 @@ def tower_auth_config(module): def tower_check_mode(module): - '''Execute check mode logic for Automation Controller modules''' + '''Execute check mode logic for Automation Platform Controller modules''' if module.check_mode: try: result = client.get('/ping').json() diff --git a/awx_collection/plugins/modules/ad_hoc_command.py b/awx_collection/plugins/modules/ad_hoc_command.py index ae04b00963..355e60362b 100644 --- a/awx_collection/plugins/modules/ad_hoc_command.py +++ b/awx_collection/plugins/modules/ad_hoc_command.py @@ -17,9 +17,9 @@ DOCUMENTATION = ''' module: ad_hoc_command author: "John Westcott IV (@john-westcott-iv)" version_added: "4.0" -short_description: create, update, or destroy Automation Controller ad hoc commands. +short_description: create, update, or destroy Automation Platform Controller ad hoc commands. description: - - Create, update, or destroy Automation Controller ad hoc commands. See + - Create, update, or destroy Automation Platform Controller ad hoc commands. See U(https://www.ansible.com/tower) for an overview. options: job_type: @@ -84,7 +84,7 @@ options: type: bool interval: description: - - The interval to request an update from Tower. + - The interval to request an update from the controller. default: 1 type: float timeout: diff --git a/awx_collection/plugins/modules/ad_hoc_command_cancel.py b/awx_collection/plugins/modules/ad_hoc_command_cancel.py index 40e51d93f2..147ce838d1 100644 --- a/awx_collection/plugins/modules/ad_hoc_command_cancel.py +++ b/awx_collection/plugins/modules/ad_hoc_command_cancel.py @@ -16,9 +16,9 @@ DOCUMENTATION = ''' --- module: ad_hoc_command_cancel author: "John Westcott IV (@john-westcott-iv)" -short_description: Cancel an Automation Controller Ad Hoc Command. +short_description: Cancel an Ad Hoc Command. description: - - Cancel Automation Controller ad hoc command. See + - Cancel ad hoc command. See U(https://www.ansible.com/tower) for an overview. options: command_id: @@ -33,14 +33,14 @@ options: type: bool interval: description: - - The interval in seconds, to request an update from Tower. + - The interval in seconds, to request an update from . required: False default: 1 type: float timeout: description: - Maximum time in seconds to wait for a job to finish. - - Not specifying means the task will wait until Tower cancels the command. + - Not specifying means the task will wait until the controller cancels the command. type: int extends_documentation_fragment: awx.awx.auth ''' diff --git a/awx_collection/plugins/modules/ad_hoc_command_wait.py b/awx_collection/plugins/modules/ad_hoc_command_wait.py index f547b93c06..5084d4a075 100644 --- a/awx_collection/plugins/modules/ad_hoc_command_wait.py +++ b/awx_collection/plugins/modules/ad_hoc_command_wait.py @@ -16,9 +16,9 @@ DOCUMENTATION = ''' --- module: ad_hoc_command_wait author: "John Westcott IV (@john-westcott-iv)" -short_description: Wait for Automation Controller Ad Hoc Command to finish. +short_description: Wait for Automation Platform Controller Ad Hoc Command to finish. description: - - Wait for Automation Controller ad hoc command to finish and report success or failure. See + - Wait for Automation Platform Controller ad hoc command to finish and report success or failure. See U(https://www.ansible.com/tower) for an overview. options: command_id: @@ -28,7 +28,7 @@ options: type: int interval: description: - - The interval in sections, to request an update from Tower. + - The interval in sections, to request an update from the controller. required: False default: 1 type: float @@ -112,7 +112,7 @@ def main(): ) if command is None: - module.fail_json(msg='Unable to wait on ad hoc command {0}; that ID does not exist in Tower.'.format(command_id)) + module.fail_json(msg='Unable to wait on ad hoc command {0}; that ID does not exist.'.format(command_id)) # Invoke wait function module.wait_on_url(url=command['url'], object_name=command_id, object_type='ad hoc command', timeout=timeout, interval=interval) diff --git a/awx_collection/plugins/modules/application.py b/awx_collection/plugins/modules/application.py index c8602a3281..d12d15a171 100644 --- a/awx_collection/plugins/modules/application.py +++ b/awx_collection/plugins/modules/application.py @@ -16,9 +16,9 @@ DOCUMENTATION = ''' --- module: application author: "Geoffrey Bacheot (@jffz)" -short_description: create, update, or destroy Automation Controller applications +short_description: create, update, or destroy Automation Platform Controller applications description: - - Create, update, or destroy Automation Controller applications. See + - Create, update, or destroy Automation Platform Controller applications. See U(https://www.ansible.com/tower) for an overview. options: name: diff --git a/awx_collection/plugins/modules/credential.py b/awx_collection/plugins/modules/credential.py index 9cc84f6e72..6675f191cf 100644 --- a/awx_collection/plugins/modules/credential.py +++ b/awx_collection/plugins/modules/credential.py @@ -16,9 +16,9 @@ DOCUMENTATION = ''' --- module: credential author: "Wayne Witzel III (@wwitzel3)" -short_description: create, update, or destroy Automation Controller credential. +short_description: create, update, or destroy Automation Platform Controller credential. description: - - Create, update, or destroy Automation Controller credentials. See + - Create, update, or destroy Automation Platform Controller credentials. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -56,7 +56,7 @@ options: description: - >- Credential inputs where the keys are var names used in templating. - Refer to the Automation Controller documentation for example syntax. + Refer to the Automation Platform Controller documentation for example syntax. - Any fields in this dict will take prescedence over any fields mentioned below (i.e. host, username, etc) type: dict update_secrets: @@ -96,7 +96,7 @@ options: password: description: - Password for this credential. ``secret_key`` for AWS. ``api_key`` for RAX. - - Use "ASK" and launch in Tower to be prompted. + - Use "ASK" and launch job to be prompted. - Deprecated, please use inputs type: str project: @@ -112,7 +112,7 @@ options: ssh_key_unlock: description: - Unlock password for ssh_key. - - Use "ASK" and launch in Tower to be prompted. + - Use "ASK" and launch job to be prompted. - Deprecated, please use inputs type: str authorize: @@ -166,19 +166,19 @@ options: become_username: description: - Become username. - - Use "ASK" and launch in Tower to be prompted. + - Use "ASK" and launch job to be prompted. - Deprecated, please use inputs type: str become_password: description: - Become password. - - Use "ASK" and launch in Tower to be prompted. + - Use "ASK" and launch job to be prompted. - Deprecated, please use inputs type: str vault_password: description: - Vault password. - - Use "ASK" and launch in Tower to be prompted. + - Use "ASK" and launch job to be prompted. - Deprecated, please use inputs type: str vault_id: @@ -203,7 +203,7 @@ notes: EXAMPLES = ''' -- name: Add tower machine credential +- name: Add machine credential credential: name: Team Name description: Team Description @@ -229,7 +229,7 @@ EXAMPLES = ''' src: '$HOME/.ssh/aws-private.pem' register: aws_ssh_key -- name: Add Credential Into Tower +- name: Add Credential credential: name: Workshop Credential credential_type: Machine diff --git a/awx_collection/plugins/modules/credential_input_source.py b/awx_collection/plugins/modules/credential_input_source.py index de1b8e25e2..4d57c4bf90 100644 --- a/awx_collection/plugins/modules/credential_input_source.py +++ b/awx_collection/plugins/modules/credential_input_source.py @@ -17,9 +17,9 @@ DOCUMENTATION = ''' module: credential_input_source author: "Tom Page (@Tompage1994)" version_added: "2.3" -short_description: create, update, or destroy Automation Controller credential input sources. +short_description: create, update, or destroy Automation Platform Controller credential input sources. description: - - Create, update, or destroy Automation Controller credential input sources. See + - Create, update, or destroy Automation Platform Controller credential input sources. See U(https://www.ansible.com/tower) for an overview. options: description: diff --git a/awx_collection/plugins/modules/credential_type.py b/awx_collection/plugins/modules/credential_type.py index 7dff67bc5f..f9c4d4985a 100644 --- a/awx_collection/plugins/modules/credential_type.py +++ b/awx_collection/plugins/modules/credential_type.py @@ -17,9 +17,9 @@ DOCUMENTATION = ''' --- module: credential_type author: "Adrien Fleury (@fleu42)" -short_description: Create, update, or destroy custom Automation Controller credential type. +short_description: Create, update, or destroy custom Automation Platform Controller credential type. description: - - Create, update, or destroy Automation Controller credential type. See + - Create, update, or destroy Automation Platform Controller credential type. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -42,14 +42,14 @@ options: inputs: description: - >- - Enter inputs using either JSON or YAML syntax. Refer to the Ansible - Tower documentation for example syntax. + Enter inputs using either JSON or YAML syntax. Refer to the + Automation Platform Controler documentation for example syntax. type: dict injectors: description: - >- Enter injectors using either JSON or YAML syntax. Refer to the - Automation Controller documentation for example syntax. + Automation Platform Controller documentation for example syntax. type: dict state: description: diff --git a/awx_collection/plugins/modules/execution_environment.py b/awx_collection/plugins/modules/execution_environment.py index a419b0697b..a67532d3b6 100644 --- a/awx_collection/plugins/modules/execution_environment.py +++ b/awx_collection/plugins/modules/execution_environment.py @@ -16,9 +16,9 @@ DOCUMENTATION = ''' --- module: execution_environment author: "Shane McDonald (@shanemcd)" -short_description: create, update, or destroy Execution Environments in Automation Controller. +short_description: create, update, or destroy Execution Environments in Automation Platform Controller. description: - - Create, update, or destroy Execution Environments in Automation Controller. See + - Create, update, or destroy Execution Environments in Automation Platform Controller. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -60,7 +60,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' -- name: Add EE to Tower +- name: Add EE to the controller instance execution_environment: name: "My EE" image: quay.io/ansible/awx-ee diff --git a/awx_collection/plugins/modules/export.py b/awx_collection/plugins/modules/export.py index c50632ee6b..f45bbd870d 100644 --- a/awx_collection/plugins/modules/export.py +++ b/awx_collection/plugins/modules/export.py @@ -17,9 +17,9 @@ DOCUMENTATION = ''' module: export author: "John Westcott IV (@john-westcott-iv)" version_added: "3.7" -short_description: export resources from Automation Controller. +short_description: export resources from Automation Platform Controller. description: - - Export assets from Automation Controller. + - Export assets from Automation Platform Controller. options: all: description: @@ -82,7 +82,7 @@ extends_documentation_fragment: awx.awx.auth ''' EXAMPLES = ''' -- name: Export all tower assets +- name: Export all assets export: all: True @@ -124,7 +124,7 @@ def main(): if not HAS_EXPORTABLE_RESOURCES: module.fail_json(msg="Your version of awxkit does not have import/export") - # The export process will never change a Tower system + # The export process will never change the AWX system module.json_output['changed'] = False # The exporter code currently works like the following: diff --git a/awx_collection/plugins/modules/group.py b/awx_collection/plugins/modules/group.py index 8a9fe46673..752fe4891a 100644 --- a/awx_collection/plugins/modules/group.py +++ b/awx_collection/plugins/modules/group.py @@ -16,9 +16,9 @@ DOCUMENTATION = ''' --- module: group author: "Wayne Witzel III (@wwitzel3)" -short_description: create, update, or destroy Automation Controller group. +short_description: create, update, or destroy Automation Platform Controller group. description: - - Create, update, or destroy Automation Controller groups. See + - Create, update, or destroy Automation Platform Controller groups. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -53,12 +53,12 @@ options: - groups preserve_existing_hosts: description: - - Provide option (False by default) to preserves existing hosts in an existing group in tower. + - Provide option (False by default) to preserves existing hosts in an existing group. default: False type: bool preserve_existing_children: description: - - Provide option (False by default) to preserves existing children in an existing group in tower. + - Provide option (False by default) to preserves existing children in an existing group. default: False type: bool aliases: @@ -78,7 +78,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' -- name: Add tower group +- name: Add group group: name: localhost description: "Local Host Group" @@ -86,7 +86,7 @@ EXAMPLES = ''' state: present tower_config_file: "~/tower_cli.cfg" -- name: Add tower group +- name: Add group group: name: Cities description: "Local Host Group" diff --git a/awx_collection/plugins/modules/host.py b/awx_collection/plugins/modules/host.py index edb343e1de..ee7f6899b1 100644 --- a/awx_collection/plugins/modules/host.py +++ b/awx_collection/plugins/modules/host.py @@ -16,9 +16,9 @@ DOCUMENTATION = ''' --- module: host author: "Wayne Witzel III (@wwitzel3)" -short_description: create, update, or destroy Automation Controller host. +short_description: create, update, or destroy Automation Platform Controller host. description: - - Create, update, or destroy Automation Controller hosts. See + - Create, update, or destroy Automation Platform Controller hosts. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -59,7 +59,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' -- name: Add tower host +- name: Add host host: name: localhost description: "Local Host Group" diff --git a/awx_collection/plugins/modules/import.py b/awx_collection/plugins/modules/import.py index b88ae41d59..c1e741ed77 100644 --- a/awx_collection/plugins/modules/import.py +++ b/awx_collection/plugins/modules/import.py @@ -17,15 +17,15 @@ DOCUMENTATION = ''' module: import author: "John Westcott (@john-westcott-iv)" version_added: "3.7" -short_description: import resources into Automation Controller. +short_description: import resources into Automation Platform Controller. description: - - Import assets into Automation Controller. See + - Import assets into Automation Platform Controller. See U(https://www.ansible.com/tower) for an overview. options: assets: description: - The assets to import. - - This can be the output of tower_export or loaded from a file + - This can be the output of the export module or loaded from a file required: True type: dict requirements: @@ -39,7 +39,7 @@ EXAMPLES = ''' all: True register: export_output -- name: Import all tower assets from our export +- name: Import all assets from our export import: assets: "{{ export_output.assets }}" diff --git a/awx_collection/plugins/modules/instance_group.py b/awx_collection/plugins/modules/instance_group.py index 37246d5e60..4b7713d16c 100644 --- a/awx_collection/plugins/modules/instance_group.py +++ b/awx_collection/plugins/modules/instance_group.py @@ -17,9 +17,9 @@ DOCUMENTATION = ''' module: instance_group author: "John Westcott IV (@john-westcott-iv)" version_added: "4.0" -short_description: create, update, or destroy Automation Controller instance groups. +short_description: create, update, or destroy Automation Platform Controller instance groups. description: - - Create, update, or destroy Automation Controller instance groups. See + - Create, update, or destroy Automation Platform Controller instance groups. See U(https://www.ansible.com/tower) for an overview. options: name: diff --git a/awx_collection/plugins/modules/inventory.py b/awx_collection/plugins/modules/inventory.py index 4f4d6ac833..8b63983b3f 100644 --- a/awx_collection/plugins/modules/inventory.py +++ b/awx_collection/plugins/modules/inventory.py @@ -16,9 +16,9 @@ DOCUMENTATION = ''' --- module: inventory author: "Wayne Witzel III (@wwitzel3)" -short_description: create, update, or destroy Automation Controller inventory. +short_description: create, update, or destroy Automation Platform Controller inventory. description: - - Create, update, or destroy Automation Controller inventories. See + - Create, update, or destroy Automation Platform Controller inventories. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -77,7 +77,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' -- name: Add tower inventory +- name: Add inventory inventory: name: "Foo Inventory" description: "Our Foo Cloud Servers" @@ -85,7 +85,7 @@ EXAMPLES = ''' state: present tower_config_file: "~/tower_cli.cfg" -- name: Copy tower inventory +- name: Copy inventory inventory: name: Copy Foo Inventory copy_from: Default Inventory diff --git a/awx_collection/plugins/modules/inventory_source.py b/awx_collection/plugins/modules/inventory_source.py index 65168c321b..86882c5a11 100644 --- a/awx_collection/plugins/modules/inventory_source.py +++ b/awx_collection/plugins/modules/inventory_source.py @@ -16,9 +16,9 @@ DOCUMENTATION = ''' --- module: inventory_source author: "Adrien Fleury (@fleu42)" -short_description: create, update, or destroy Automation Controller inventory source. +short_description: create, update, or destroy Automation Platform Controller inventory source. description: - - Create, update, or destroy Automation Controller inventory source. See + - Create, update, or destroy Automation Platform Controller inventory source. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -162,7 +162,7 @@ def main(): description=dict(), inventory=dict(required=True), # - # How do we handle manual and file? Tower does not seem to be able to activate them + # How do we handle manual and file? The controller does not seem to be able to activate them # source=dict(choices=["scm", "ec2", "gce", "azure_rm", "vmware", "satellite6", "openstack", "rhv", "tower"]), source_path=dict(), diff --git a/awx_collection/plugins/modules/inventory_source_update.py b/awx_collection/plugins/modules/inventory_source_update.py index 07aca6dca4..ebdd7ca9cc 100644 --- a/awx_collection/plugins/modules/inventory_source_update.py +++ b/awx_collection/plugins/modules/inventory_source_update.py @@ -18,7 +18,7 @@ module: inventory_source_update author: "Bianca Henderson (@beeankha)" short_description: Update inventory source(s). description: - - Update Automation Controller inventory source(s). See + - Update Automation Platform Controller inventory source(s). See U(https://www.ansible.com/tower) for an overview. options: name: @@ -44,7 +44,7 @@ options: type: bool interval: description: - - The interval to request an update from Tower. + - The interval to request an update from the controller. required: False default: 1 type: float diff --git a/awx_collection/plugins/modules/job_cancel.py b/awx_collection/plugins/modules/job_cancel.py index 5a2d071ef3..a987b7bec5 100644 --- a/awx_collection/plugins/modules/job_cancel.py +++ b/awx_collection/plugins/modules/job_cancel.py @@ -16,9 +16,9 @@ DOCUMENTATION = ''' --- module: job_cancel author: "Wayne Witzel III (@wwitzel3)" -short_description: Cancel an Automation Controller Job. +short_description: Cancel an Automation Platform Controller Job. description: - - Cancel Automation Controller jobs. See + - Cancel Automation Platform Controller jobs. See U(https://www.ansible.com/tower) for an overview. options: job_id: @@ -81,7 +81,7 @@ def main(): cancel_page = module.get_endpoint(job['related']['cancel']) if 'json' not in cancel_page or 'can_cancel' not in cancel_page['json']: - module.fail_json(msg="Failed to cancel job, got unexpected response from tower", **{'response': cancel_page}) + module.fail_json(msg="Failed to cancel job, got unexpected response from the controller", **{'response': cancel_page}) if not cancel_page['json']['can_cancel']: if fail_if_not_running: diff --git a/awx_collection/plugins/modules/job_launch.py b/awx_collection/plugins/modules/job_launch.py index 52edec1762..193e2c1e61 100644 --- a/awx_collection/plugins/modules/job_launch.py +++ b/awx_collection/plugins/modules/job_launch.py @@ -18,7 +18,7 @@ module: job_launch author: "Wayne Witzel III (@wwitzel3)" short_description: Launch an Ansible Job. description: - - Launch an Automation Controller jobs. See + - Launch an Automation Platform Controller jobs. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -51,7 +51,7 @@ options: extra_vars: description: - extra_vars to use for the Job Template. - - ask_extra_vars needs to be set to True via tower_job_template module + - ask_extra_vars needs to be set to True via job_template module when creating the Job Template. type: dict limit: @@ -93,7 +93,7 @@ options: type: bool interval: description: - - The interval to request an update from Tower. + - The interval to request an update from the controller. required: False default: 1 type: float @@ -111,7 +111,7 @@ EXAMPLES = ''' job_template: "My Job Template" register: job -- name: Launch a job template with extra_vars on remote Tower instance +- name: Launch a job template with extra_vars on remote controller instance job_launch: job_template: "My Job Template" extra_vars: diff --git a/awx_collection/plugins/modules/job_list.py b/awx_collection/plugins/modules/job_list.py index 831b722c69..61cf6c3418 100644 --- a/awx_collection/plugins/modules/job_list.py +++ b/awx_collection/plugins/modules/job_list.py @@ -16,9 +16,9 @@ DOCUMENTATION = ''' --- module: job_list author: "Wayne Witzel III (@wwitzel3)" -short_description: List Automation Controller jobs. +short_description: List Automation Platform Controller jobs. description: - - List Automation Controller jobs. See + - List Automation Platform Controller jobs. See U(https://www.ansible.com/tower) for an overview. options: status: diff --git a/awx_collection/plugins/modules/job_template.py b/awx_collection/plugins/modules/job_template.py index 24711cfd4c..2bae27bb64 100644 --- a/awx_collection/plugins/modules/job_template.py +++ b/awx_collection/plugins/modules/job_template.py @@ -16,9 +16,9 @@ DOCUMENTATION = ''' --- module: job_template author: "Wayne Witzel III (@wwitzel3)" -short_description: create, update, or destroy Automation Controller job templates. +short_description: create, update, or destroy Automation Platform Controller job templates. description: - - Create, update, or destroy Automation Controller job templates. See + - Create, update, or destroy Automation Platform Controller job templates. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -57,7 +57,7 @@ options: - Used to help lookup the object, cannot be modified using this module. - The Organization is inferred from the associated project - If not provided, will lookup by name only, which does not work with duplicates. - - Requires Tower Version 3.7.0 or AWX 10.0.0 IS NOT backwards compatible with earlier versions. + - Requires Automation Platform Version 3.7.0 or AWX 10.0.0 IS NOT backwards compatible with earlier versions. type: str project: description: @@ -297,14 +297,14 @@ options: extends_documentation_fragment: awx.awx.auth notes: - - JSON for survey_spec can be found in Tower API Documentation. See + - JSON for survey_spec can be found in the API Documentation. See U(https://docs.ansible.com/ansible-tower/latest/html/towerapi/api_ref.html#/Job_Templates/Job_Templates_job_templates_survey_spec_create) for POST operation payload example. ''' EXAMPLES = ''' -- name: Create Tower Ping job template +- name: Create Ping job template job_template: name: "Ping" job_type: "run" @@ -534,7 +534,7 @@ def main(): } ) if project_data is None: - module.fail_json(msg="The project {0} in organization {1} was not found on the Tower server".format(project, organization)) + module.fail_json(msg="The project {0} in organization {1} was not found on the controller instance server".format(project, organization)) new_fields['project'] = project_data['id'] else: new_fields['project'] = module.resolve_name_to_id('projects', project) diff --git a/awx_collection/plugins/modules/job_wait.py b/awx_collection/plugins/modules/job_wait.py index 4c10adffed..110bffc3c4 100644 --- a/awx_collection/plugins/modules/job_wait.py +++ b/awx_collection/plugins/modules/job_wait.py @@ -16,9 +16,9 @@ DOCUMENTATION = ''' --- module: job_wait author: "Wayne Witzel III (@wwitzel3)" -short_description: Wait for Automation Controller job to finish. +short_description: Wait for Automation Platform Controller job to finish. description: - - Wait for Automation Controller job to finish and report success or failure. See + - Wait for Automation Platform Controller job to finish and report success or failure. See U(https://www.ansible.com/tower) for an overview. options: job_id: @@ -28,19 +28,19 @@ options: type: int interval: description: - - The interval in sections, to request an update from Tower. + - The interval in sections, to request an update from the controller. - For backwards compatibility if unset this will be set to the average of min and max intervals required: False default: 1 type: float min_interval: description: - - Minimum interval in seconds, to request an update from Tower. + - Minimum interval in seconds, to request an update from the controller. - deprecated, use interval instead type: float max_interval: description: - - Maximum interval in seconds, to request an update from Tower. + - Maximum interval in seconds, to request an update from the controller. - deprecated, use interval instead type: float timeout: @@ -147,7 +147,7 @@ def main(): ) if job is None: - module.fail_json(msg='Unable to wait on ' + job_type.rstrip("s") + ' {0}; that ID does not exist in Tower.'.format(job_id)) + module.fail_json(msg='Unable to wait on ' + job_type.rstrip("s") + ' {0}; that ID does not exist.'.format(job_id)) # Invoke wait function result = module.wait_on_url(url=job['url'], object_name=job_id, object_type='legacy_job_wait', timeout=timeout, interval=interval) diff --git a/awx_collection/plugins/modules/label.py b/awx_collection/plugins/modules/label.py index c37c0335b2..b17d58beec 100644 --- a/awx_collection/plugins/modules/label.py +++ b/awx_collection/plugins/modules/label.py @@ -16,11 +16,11 @@ DOCUMENTATION = ''' --- module: label author: "Wayne Witzel III (@wwitzel3)" -short_description: create, update, or destroy Automation Controller labels. +short_description: create, update, or destroy Automation Platform Controller labels. description: - - Create, update, or destroy Automation Controller labels. See + - Create, update, or destroy Automation Platform Controller labels. See U(https://www.ansible.com/tower) for an overview. - - Note, labels can only be created via the Tower API, they can not be deleted. + - Note, labels can only be created via the API, they can not be deleted. Once they are fully disassociated the API will clean them up on its own. options: name: @@ -47,7 +47,7 @@ extends_documentation_fragment: awx.awx.auth ''' EXAMPLES = ''' -- name: Add label to tower organization +- name: Add label to organization label: name: Custom Label organization: My Organization diff --git a/awx_collection/plugins/modules/license.py b/awx_collection/plugins/modules/license.py index c8e3670d46..9325fc0359 100644 --- a/awx_collection/plugins/modules/license.py +++ b/awx_collection/plugins/modules/license.py @@ -15,9 +15,9 @@ DOCUMENTATION = ''' --- module: license author: "John Westcott IV (@john-westcott-iv)" -short_description: Set the license for Automation Controller +short_description: Set the license for Automation Platform Controller description: - - Get or Set Automation Controller license. See + - Get or Set Automation Platform Controller license. See U(https://www.ansible.com/tower) for an overview. options: manifest: diff --git a/awx_collection/plugins/modules/notification_template.py b/awx_collection/plugins/modules/notification_template.py index 78a0d6e147..c959b89cad 100644 --- a/awx_collection/plugins/modules/notification_template.py +++ b/awx_collection/plugins/modules/notification_template.py @@ -16,9 +16,9 @@ DOCUMENTATION = ''' --- module: notification_template author: "Samuel Carpentier (@samcarpentier)" -short_description: create, update, or destroy Automation Controller notification. +short_description: create, update, or destroy Automation Platform Controller notification. description: - - Create, update, or destroy Automation Controller notifications. See + - Create, update, or destroy Automation Platform Controller notifications. See U(https://www.ansible.com/tower) for an overview. options: name: diff --git a/awx_collection/plugins/modules/organization.py b/awx_collection/plugins/modules/organization.py index ef255b859b..fd45452509 100644 --- a/awx_collection/plugins/modules/organization.py +++ b/awx_collection/plugins/modules/organization.py @@ -16,9 +16,9 @@ DOCUMENTATION = ''' --- module: organization author: "Wayne Witzel III (@wwitzel3)" -short_description: create, update, or destroy Automation Controller organizations +short_description: create, update, or destroy Automation Platform Controller organizations description: - - Create, update, or destroy Automation Controller organizations. See + - Create, update, or destroy Automation Platform Controller organizations. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -86,21 +86,21 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' -- name: Create tower organization +- name: Create organization organization: name: "Foo" description: "Foo bar organization" state: present tower_config_file: "~/tower_cli.cfg" -- name: Create tower organization using 'foo-venv' as default Python virtualenv +- name: Create organization using 'foo-venv' as default Python virtualenv organization: name: "Foo" description: "Foo bar organization using foo-venv" state: present tower_config_file: "~/tower_cli.cfg" -- name: Create tower organization that pulls content from galaxy.ansible.com +- name: Create organization that pulls content from galaxy.ansible.com organization: name: "Foo" state: present diff --git a/awx_collection/plugins/modules/project.py b/awx_collection/plugins/modules/project.py index e3e296490c..0f6f68ce2c 100644 --- a/awx_collection/plugins/modules/project.py +++ b/awx_collection/plugins/modules/project.py @@ -16,9 +16,9 @@ DOCUMENTATION = ''' --- module: project author: "Wayne Witzel III (@wwitzel3)" -short_description: create, update, or destroy Automation Controller projects +short_description: create, update, or destroy Automation Platform Controller projects description: - - Create, update, or destroy Automation Controller projects. See + - Create, update, or destroy Automation Platform Controller projects. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -160,7 +160,7 @@ options: type: bool interval: description: - - The interval to request an update from Tower. + - The interval to request an update from the controller. - Requires wait. required: False default: 1 @@ -170,7 +170,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' -- name: Add tower project +- name: Add project project: name: "Foo" description: "Foo bar project" @@ -178,7 +178,7 @@ EXAMPLES = ''' state: present tower_config_file: "~/tower_cli.cfg" -- name: Add Tower Project with cache timeout +- name: Add Project with cache timeout project: name: "Foo" description: "Foo bar project" @@ -188,7 +188,7 @@ EXAMPLES = ''' state: present tower_config_file: "~/tower_cli.cfg" -- name: Copy tower project +- name: Copy project project: name: copy copy_from: test diff --git a/awx_collection/plugins/modules/project_update.py b/awx_collection/plugins/modules/project_update.py index 9931b9766f..480fe98d8f 100644 --- a/awx_collection/plugins/modules/project_update.py +++ b/awx_collection/plugins/modules/project_update.py @@ -13,9 +13,9 @@ DOCUMENTATION = ''' --- module: project_update author: "Sean Sullivan (@sean-m-sullivan)" -short_description: Update a Project in Automation Controller +short_description: Update a Project in Automation Platform Controller description: - - Update a Automation Controller Project. See + - Update a Automation Platform Controller Project. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -39,7 +39,7 @@ options: type: bool interval: description: - - The interval to request an update from Tower. + - The interval to request an update from the controller. required: False default: 1 type: float diff --git a/awx_collection/plugins/modules/receive.py b/awx_collection/plugins/modules/receive.py index 194bd6d347..e941b648ec 100644 --- a/awx_collection/plugins/modules/receive.py +++ b/awx_collection/plugins/modules/receive.py @@ -20,9 +20,9 @@ deprecated: why: Deprecated in favor of upcoming C(_export) module. alternative: Once published, use M(tower_export) instead. author: "John Westcott IV (@john-westcott-iv)" -short_description: Receive assets from Automation Controller. +short_description: Receive assets from Automation Platform Controller. description: - - Receive assets from Automation Controller. See + - Receive assets from Automation Platform Controller. See U(https://www.ansible.com/tower) for an overview. options: all: @@ -101,7 +101,7 @@ extends_documentation_fragment: awx.awx.auth_legacy ''' EXAMPLES = ''' -- name: Export all tower assets +- name: Export all Automation Platform Controller assets receive: all: True tower_config_file: "~/tower_cli.cfg" diff --git a/awx_collection/plugins/modules/role.py b/awx_collection/plugins/modules/role.py index 915a0b4fc6..211117ee34 100644 --- a/awx_collection/plugins/modules/role.py +++ b/awx_collection/plugins/modules/role.py @@ -16,10 +16,10 @@ DOCUMENTATION = ''' --- module: role author: "Wayne Witzel III (@wwitzel3)" -short_description: grant or revoke an Automation Controller role. +short_description: grant or revoke an Automation Platform Controller role. description: - Roles are used for access control, this module is for managing user access to server resources. - - Grant or revoke Automation Controller roles to users. See U(https://www.ansible.com/tower) for an overview. + - Grant or revoke Automation Platform Controller roles to users. See U(https://www.ansible.com/tower) for an overview. options: user: description: diff --git a/awx_collection/plugins/modules/schedule.py b/awx_collection/plugins/modules/schedule.py index b2c06277a5..e9037cada7 100644 --- a/awx_collection/plugins/modules/schedule.py +++ b/awx_collection/plugins/modules/schedule.py @@ -16,9 +16,9 @@ DOCUMENTATION = ''' --- module: schedule author: "John Westcott IV (@john-westcott-iv)" -short_description: create, update, or destroy Automation Controller schedules. +short_description: create, update, or destroy Automation Platform Controller schedules. description: - - Create, update, or destroy Automation Controller schedules. See + - Create, update, or destroy Automation Platform Controller schedules. See U(https://www.ansible.com/tower) for an overview. options: rrule: @@ -131,7 +131,7 @@ EXAMPLES = ''' name: "{{ sched1 }}" state: present unified_job_template: "Demo Job Template" - rrule: "{{ query('awx.awx.tower_schedule_rrule', 'week', start_date='2019-12-19 13:05:51') }}" + rrule: "{{ query('awx.awx.schedule_rrule', 'week', start_date='2019-12-19 13:05:51') }}" register: result ''' diff --git a/awx_collection/plugins/modules/send.py b/awx_collection/plugins/modules/send.py index 1b06829b8f..2f5588a7e9 100644 --- a/awx_collection/plugins/modules/send.py +++ b/awx_collection/plugins/modules/send.py @@ -20,9 +20,9 @@ deprecated: why: Deprecated in favor of upcoming C(_import) module. alternative: Once published, use M(tower_import) instead. author: "John Westcott IV (@john-westcott-iv)" -short_description: Send assets to Automation Controller. +short_description: Send assets to Automation Platform Controller. description: - - Send assets to Automation Controller. See + - Send assets to Automation Platform Controller. See U(https://www.ansible.com/tower) for an overview. options: assets: @@ -62,7 +62,7 @@ extends_documentation_fragment: awx.awx.auth_legacy ''' EXAMPLES = ''' -- name: Import all tower assets +- name: Import all Automation Platform Controller assets send: assets: "{{ export_output.assets }}" tower_config_file: "~/tower_cli.cfg" diff --git a/awx_collection/plugins/modules/settings.py b/awx_collection/plugins/modules/settings.py index e77dd69a29..56c0b94e5a 100644 --- a/awx_collection/plugins/modules/settings.py +++ b/awx_collection/plugins/modules/settings.py @@ -16,9 +16,9 @@ DOCUMENTATION = ''' --- module: settings author: "Nikhil Jain (@jainnikhil30)" -short_description: Modify Automation Controller settings. +short_description: Modify Automation Platform Controller settings. description: - - Modify Automation Controller settings. See + - Modify Automation Platform Controller settings. See U(https://www.ansible.com/tower) for an overview. options: name: diff --git a/awx_collection/plugins/modules/team.py b/awx_collection/plugins/modules/team.py index ce51519b67..e66d541e8a 100644 --- a/awx_collection/plugins/modules/team.py +++ b/awx_collection/plugins/modules/team.py @@ -16,9 +16,9 @@ DOCUMENTATION = ''' --- module: team author: "Wayne Witzel III (@wwitzel3)" -short_description: create, update, or destroy Automation Controller team. +short_description: create, update, or destroy Automation Platform Controller team. description: - - Create, update, or destroy Automation Controller teams. See + - Create, update, or destroy Automation Platform Controller teams. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -50,7 +50,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' -- name: Create tower team +- name: Create team team: name: Team Name description: Team Description diff --git a/awx_collection/plugins/modules/token.py b/awx_collection/plugins/modules/token.py index 2f5bf2ffe3..c49c4f8f67 100644 --- a/awx_collection/plugins/modules/token.py +++ b/awx_collection/plugins/modules/token.py @@ -17,15 +17,15 @@ DOCUMENTATION = ''' module: token author: "John Westcott IV (@john-westcott-iv)" version_added: "2.3" -short_description: create, update, or destroy Automation Controller tokens. +short_description: create, update, or destroy Automation Platform Controller tokens. description: - - Create or destroy Automation Controller tokens. See + - Create or destroy Automation Platform Controller tokens. See U(https://www.ansible.com/tower) for an overview. - In addition, the module sets an Ansible fact which can be passed into other - tower_* modules as the parameter tower_oauthtoken. See examples for usage. + controller modules as the parameter tower_oauthtoken. See examples for usage. - Because of the sensitive nature of tokens, the created token value is only available once through the Ansible fact. (See RETURN for details) - - Due to the nature of tokens in Tower this module is not idempotent. A second will + - Due to the nature of tokens this module is not idempotent. A second will with the same parameters will create a new token. - If you are creating a temporary token for use with modules you should delete the token when you are done with it. See the example for how to do it. @@ -105,7 +105,7 @@ EXAMPLES = ''' RETURN = ''' token: type: dict - description: An Ansible Fact variable representing a Tower token object which can be used for auth in subsequent modules. See examples for usage. + description: An Ansible Fact variable representing a token object which can be used for auth in subsequent modules. See examples for usage. contains: token: description: The token that was generated. This token can never be accessed again, make sure this value is noted before it is lost. diff --git a/awx_collection/plugins/modules/user.py b/awx_collection/plugins/modules/user.py index ca8ba710b8..befb48e732 100644 --- a/awx_collection/plugins/modules/user.py +++ b/awx_collection/plugins/modules/user.py @@ -16,9 +16,9 @@ DOCUMENTATION = ''' --- module: user author: "John Westcott IV (@john-westcott-iv)" -short_description: create, update, or destroy Automation Controller users. +short_description: create, update, or destroy Automation Platform Controller users. description: - - Create, update, or destroy Automation Controller users. See + - Create, update, or destroy Automation Platform Controller users. See U(https://www.ansible.com/tower) for an overview. options: username: @@ -71,7 +71,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' -- name: Add tower user +- name: Add user user: username: jdoe password: foobarbaz @@ -81,7 +81,7 @@ EXAMPLES = ''' state: present tower_config_file: "~/tower_cli.cfg" -- name: Add tower user as a system administrator +- name: Add user as a system administrator user: username: jdoe password: foobarbaz @@ -90,7 +90,7 @@ EXAMPLES = ''' state: present tower_config_file: "~/tower_cli.cfg" -- name: Add tower user as a system auditor +- name: Add user as a system auditor user: username: jdoe password: foobarbaz @@ -99,7 +99,7 @@ EXAMPLES = ''' state: present tower_config_file: "~/tower_cli.cfg" -- name: Delete tower user +- name: Delete user user: username: jdoe email: jdoe@example.org diff --git a/awx_collection/plugins/modules/workflow_approval.py b/awx_collection/plugins/modules/workflow_approval.py index 07fb1f82eb..bb8c24dfb8 100644 --- a/awx_collection/plugins/modules/workflow_approval.py +++ b/awx_collection/plugins/modules/workflow_approval.py @@ -43,7 +43,7 @@ options: type: str interval: description: - - The interval in sections, to request an update from Tower. + - The interval in sections, to request an update from the controller. required: False default: 1 type: float diff --git a/awx_collection/plugins/modules/workflow_job_template.py b/awx_collection/plugins/modules/workflow_job_template.py index 5b42e95a9e..741397b99f 100644 --- a/awx_collection/plugins/modules/workflow_job_template.py +++ b/awx_collection/plugins/modules/workflow_job_template.py @@ -16,11 +16,11 @@ DOCUMENTATION = ''' --- module: workflow_job_template author: "John Westcott IV (@john-westcott-iv)" -short_description: create, update, or destroy Automation Controller workflow job templates. +short_description: create, update, or destroy Automation Platform Controller workflow job templates. description: - - Create, update, or destroy Automation Controller workflow job templates. + - Create, update, or destroy Automation Platform Controller workflow job templates. - Replaces the deprecated tower_workflow_template module. - - Use the tower_workflow_job_template_node after this, or use the schema parameter to build the workflow's graph + - Use workflow_job_template_node after this, or use the schema parameter to build the workflow's graph options: name: description: diff --git a/awx_collection/plugins/modules/workflow_job_template_node.py b/awx_collection/plugins/modules/workflow_job_template_node.py index ec841d2abd..9c950d3465 100644 --- a/awx_collection/plugins/modules/workflow_job_template_node.py +++ b/awx_collection/plugins/modules/workflow_job_template_node.py @@ -16,9 +16,9 @@ DOCUMENTATION = ''' --- module: workflow_job_template_node author: "John Westcott IV (@john-westcott-iv)" -short_description: create, update, or destroy Automation Controller workflow job template nodes. +short_description: create, update, or destroy Automation Platform Controller workflow job template nodes. description: - - Create, update, or destroy Automation Controller workflow job template nodes. + - Create, update, or destroy Automation Platform Controller workflow job template nodes. - Use this to build a graph for a workflow, which dictates what the workflow runs. - Replaces the deprecated tower_workflow_template module schema command. - You can create nodes first, and link them afterwards, and not worry about ordering. @@ -157,7 +157,7 @@ extends_documentation_fragment: awx.awx.auth ''' EXAMPLES = ''' -- name: Create a node, follows tower_workflow_job_template example +- name: Create a node, follows workflow_job_template example workflow_job_template_node: identifier: my-first-node workflow: example-workflow @@ -283,7 +283,9 @@ def main(): wfjt_search_fields['organization'] = organization_id wfjt_data = module.get_one('workflow_job_templates', name_or_id=workflow_job_template, **{'data': wfjt_search_fields}) if wfjt_data is None: - module.fail_json(msg="The workflow {0} in organization {1} was not found on the Tower server".format(workflow_job_template, organization)) + module.fail_json( + msg="The workflow {0} in organization {1} was not found on the controller instance server".format(workflow_job_template, organization) + ) workflow_job_template_id = wfjt_data['id'] search_fields['workflow_job_template'] = new_fields['workflow_job_template'] = workflow_job_template_id diff --git a/awx_collection/plugins/modules/workflow_launch.py b/awx_collection/plugins/modules/workflow_launch.py index f3854116b5..aa626c7861 100644 --- a/awx_collection/plugins/modules/workflow_launch.py +++ b/awx_collection/plugins/modules/workflow_launch.py @@ -13,9 +13,9 @@ DOCUMENTATION = ''' --- module: workflow_launch author: "John Westcott IV (@john-westcott-iv)" -short_description: Run a workflow in Automation Controller +short_description: Run a workflow in Automation Platform Controller description: - - Launch an Automation Controller workflows. See + - Launch an Automation Platform Controller workflows. See U(https://www.ansible.com/tower) for an overview. options: name: @@ -55,7 +55,7 @@ options: type: bool interval: description: - - The interval to request an update from Tower. + - The interval to request an update from the controller. required: False default: 1 type: float diff --git a/awx_collection/plugins/modules/workflow_node_wait.py b/awx_collection/plugins/modules/workflow_node_wait.py index a8b4abaf43..3fdeed46ae 100644 --- a/awx_collection/plugins/modules/workflow_node_wait.py +++ b/awx_collection/plugins/modules/workflow_node_wait.py @@ -37,7 +37,7 @@ options: type: str interval: description: - - The interval in sections, to request an update from Tower. + - The interval in sections, to request an update from the controller. required: False default: 1 type: float diff --git a/awx_collection/plugins/modules/workflow_template.py b/awx_collection/plugins/modules/workflow_template.py index 05654c377d..f100ee46f2 100644 --- a/awx_collection/plugins/modules/workflow_template.py +++ b/awx_collection/plugins/modules/workflow_template.py @@ -20,7 +20,7 @@ deprecated: why: Deprecated in favor of C(_workflow_job_template) and C(_workflow_job_template_node) modules. alternative: Use M(tower_workflow_job_template) and M(_workflow_job_template_node) instead. author: "Adrien Fleury (@fleu42)" -short_description: create, update, or destroy Automation Controller workflow template. +short_description: create, update, or destroy Automation Platform Controller workflow template. description: - A tower-cli based module for CRUD actions on workflow job templates. - Enables use of the old schema functionality. @@ -64,7 +64,7 @@ options: description: - > The schema is a JSON- or YAML-formatted string defining the - hierarchy structure that connects the nodes. Refer to Tower + hierarchy structure that connects the nodes. Refer to the Automation Platform documentation for more information. type: list elements: dict diff --git a/awx_collection/test/awx/test_ad_hoc_wait.py b/awx_collection/test/awx/test_ad_hoc_wait.py index c55b5e32b3..fb23d7ce77 100644 --- a/awx_collection/test/awx/test_ad_hoc_wait.py +++ b/awx_collection/test/awx/test_ad_hoc_wait.py @@ -41,4 +41,4 @@ def test_ad_hoc_command_wait_failed(run_module, admin_user): def test_ad_hoc_command_wait_not_found(run_module, admin_user): result = run_module('ad_hoc_command_wait', dict(command_id=42), admin_user) result.pop('invocation', None) - assert result == {"failed": True, "msg": "Unable to wait on ad hoc command 42; that ID does not exist in Tower."} + assert result == {"failed": True, "msg": "Unable to wait on ad hoc command 42; that ID does not exist."} diff --git a/awx_collection/test/awx/test_completeness.py b/awx_collection/test/awx/test_completeness.py index a2667d9cd6..cb82255ea2 100644 --- a/awx_collection/test/awx/test_completeness.py +++ b/awx_collection/test/awx/test_completeness.py @@ -14,7 +14,7 @@ import re # Read-only endpoints are dynamically created by an options page with no POST section. # Normally a read-only endpoint should not have a module (i.e. /api/v2/me) but sometimes we reuse a name -# For example, we have a tower_role module but /api/v2/roles is a read only endpoint. +# For example, we have a role module but /api/v2/roles is a read only endpoint. # This list indicates which read-only endpoints have associated modules with them. read_only_endpoints_with_modules = ['settings', 'role', 'project_update'] @@ -61,11 +61,11 @@ no_api_parameter_ok = { 'workflow_job_template_node': ['organization', 'approval_node'], # Survey is how we handle associations 'workflow_job_template': ['survey_spec', 'destroy_current_schema'], - # ad hoc commands support interval and timeout since its more like tower_job_launch + # ad hoc commands support interval and timeout since its more like job_launch 'ad_hoc_command': ['interval', 'timeout', 'wait'], - # tower_group parameters to perserve hosts and children. + # group parameters to perserve hosts and children. 'group': ['preserve_existing_children', 'preserve_existing_hosts'], - # tower_workflow_approval parameters that do not apply when approving an approval node. + # workflow_approval parameters that do not apply when approving an approval node. 'workflow_approval': ['action', 'interval', 'timeout', 'workflow_job_id'], } diff --git a/awx_collection/test/awx/test_group.py b/awx_collection/test/awx/test_group.py index 295a72cabd..aae7af5796 100644 --- a/awx_collection/test/awx/test_group.py +++ b/awx_collection/test/awx/test_group.py @@ -78,7 +78,7 @@ def test_children_alias_of_groups(run_module, admin_user, organization): @pytest.mark.django_db -def test_tower_group_idempotent(run_module, admin_user): +def test_group_idempotent(run_module, admin_user): # https://github.com/ansible/ansible/issues/46803 org = Organization.objects.create(name='test-org') inv = Inventory.objects.create(name='test-inv', organization=org) diff --git a/awx_collection/test/awx/test_job.py b/awx_collection/test/awx/test_job.py index 3d25353e9b..1731ef3553 100644 --- a/awx_collection/test/awx/test_job.py +++ b/awx_collection/test/awx/test_job.py @@ -34,4 +34,4 @@ def test_job_wait_failed(run_module, admin_user): def test_job_wait_not_found(run_module, admin_user): result = run_module('job_wait', dict(job_id=42), admin_user) result.pop('invocation', None) - assert result == {"failed": True, "msg": "Unable to wait on job 42; that ID does not exist in Tower."} + assert result == {"failed": True, "msg": "Unable to wait on job 42; that ID does not exist."} diff --git a/awx_collection/test/awx/test_module_utils.py b/awx_collection/test/awx/test_module_utils.py index e261a74251..000a5e7809 100644 --- a/awx_collection/test/awx/test_module_utils.py +++ b/awx_collection/test/awx/test_module_utils.py @@ -10,7 +10,7 @@ from requests.models import Response from unittest import mock awx_name = 'AWX' -tower_name = 'Red Hat Automation Controller' +tower_name = 'Red Hat Automation Platform Controller' ping_version = '1.2.3' @@ -32,7 +32,7 @@ def status(self): return 200 -def mock_tower_ping_response(self, method, url, **kwargs): +def mock_controller_ping_response(self, method, url, **kwargs): r = Response() r.getheader = getTowerheader.__get__(r) r.read = read.__get__(r) @@ -86,25 +86,25 @@ def test_version_warning_strictness_awx(collection_import, silence_warning): silence_warning.assert_not_called() -def test_version_warning_strictness_tower(collection_import, silence_warning): +def test_version_warning_strictness_controller(collection_import, silence_warning): ControllerAPIModule = collection_import('plugins.module_utils.controller_api').ControllerAPIModule cli_data = {'ANSIBLE_MODULE_ARGS': {}} testargs = ['module_file2.py', json.dumps(cli_data)] # Compare 1.2.0 to 1.2.3 (major/minor matches) with mock.patch.object(sys, 'argv', testargs): - with mock.patch('ansible.module_utils.urls.Request.open', new=mock_tower_ping_response): + with mock.patch('ansible.module_utils.urls.Request.open', new=mock_controller_ping_response): my_module = ControllerAPIModule(argument_spec=dict()) my_module._COLLECTION_VERSION = "1.2.0" - my_module._COLLECTION_TYPE = "tower" + my_module._COLLECTION_TYPE = "controller" my_module.get_endpoint('ping') silence_warning.assert_not_called() # Compare 1.0.0 to 1.2.3 (major/minor fail to match) with mock.patch.object(sys, 'argv', testargs): - with mock.patch('ansible.module_utils.urls.Request.open', new=mock_tower_ping_response): + with mock.patch('ansible.module_utils.urls.Request.open', new=mock_controller_ping_response): my_module = ControllerAPIModule(argument_spec=dict()) my_module._COLLECTION_VERSION = "1.0.0" - my_module._COLLECTION_TYPE = "tower" + my_module._COLLECTION_TYPE = "controller" my_module.get_endpoint('ping') silence_warning.assert_called_once_with( 'You are running collection version {0} but connecting to {1} version {2}'.format(my_module._COLLECTION_VERSION, tower_name, ping_version) @@ -119,7 +119,7 @@ def test_type_warning(collection_import, silence_warning): with mock.patch('ansible.module_utils.urls.Request.open', new=mock_awx_ping_response): my_module = ControllerAPIModule(argument_spec={}) my_module._COLLECTION_VERSION = ping_version - my_module._COLLECTION_TYPE = "tower" + my_module._COLLECTION_TYPE = "controller" my_module.get_endpoint('ping') silence_warning.assert_called_once_with( 'You are using the {0} version of this collection but connecting to {1}'.format(my_module._COLLECTION_TYPE, awx_name) @@ -157,7 +157,7 @@ def test_no_templated_values(collection_import): 'The collection version is templated when the collection is built ' 'and the code should retain the placeholder of "0.0.1-devel".' ) InventoryModule = collection_import('plugins.inventory.controller').InventoryModule - assert InventoryModule.NAME == 'awx.awx.tower', ( + assert InventoryModule.NAME == 'awx.awx.controller', ( 'The inventory plugin FQCN is templated when the collection is built ' 'and the code should retain the default of awx.awx.' ) diff --git a/awx_collection/tests/integration/targets/ad_hoc_command/tasks/main.yml b/awx_collection/tests/integration/targets/ad_hoc_command/tasks/main.yml index b5e8a9f529..316315df30 100644 --- a/awx_collection/tests/integration/targets/ad_hoc_command/tasks/main.yml +++ b/awx_collection/tests/integration/targets/ad_hoc_command/tasks/main.yml @@ -6,9 +6,9 @@ - name: Generate names set_fact: - inv_name: "AWX-Collection-tests-tower_tower_ad_hoc_command-inventory-{{ test_id }}" - ssh_cred_name: "AWX-Collection-tests-tower_tower_ad_hoc_command-ssh-cred-{{ test_id }}" - org_name: "AWX-Collection-tests-tower_tower_ad_hoc_command-org-{{ test_id }}" + inv_name: "AWX-Collection-tests-ad_hoc_command-inventory-{{ test_id }}" + ssh_cred_name: "AWX-Collection-tests-ad_hoc_command-ssh-cred-{{ test_id }}" + org_name: "AWX-Collection-tests-ad_hoc_command-org-{{ test_id }}" - name: Create a New Organization organization: diff --git a/awx_collection/tests/integration/targets/ad_hoc_command_cancel/tasks/main.yml b/awx_collection/tests/integration/targets/ad_hoc_command_cancel/tasks/main.yml index 716bd1507c..282c596d28 100644 --- a/awx_collection/tests/integration/targets/ad_hoc_command_cancel/tasks/main.yml +++ b/awx_collection/tests/integration/targets/ad_hoc_command_cancel/tasks/main.yml @@ -6,9 +6,9 @@ - name: Generate names set_fact: - inv_name: "AWX-Collection-tests-tower_tower_ad_hoc_command_cancel-inventory-{{ test_id }}" - ssh_cred_name: "AWX-Collection-tests-tower_tower_ad_hoc_command_cancel-ssh-cred-{{ test_id }}" - org_name: "AWX-Collection-tests-tower_tower_ad_hoc_command_cancel-org-{{ test_id }}" + inv_name: "AWX-Collection-tests-ad_hoc_command_cancel-inventory-{{ test_id }}" + ssh_cred_name: "AWX-Collection-tests-ad_hoc_command_cancel-ssh-cred-{{ test_id }}" + org_name: "AWX-Collection-tests-ad_hoc_command_cancel-org-{{ test_id }}" - name: Create a New Organization organization: diff --git a/awx_collection/tests/integration/targets/ad_hoc_command_wait/tasks/main.yml b/awx_collection/tests/integration/targets/ad_hoc_command_wait/tasks/main.yml index e92627c810..941774874f 100644 --- a/awx_collection/tests/integration/targets/ad_hoc_command_wait/tasks/main.yml +++ b/awx_collection/tests/integration/targets/ad_hoc_command_wait/tasks/main.yml @@ -6,9 +6,9 @@ - name: Generate names set_fact: - inv_name: "AWX-Collection-tests-tower_ad_hoc_command_wait-inventory-{{ test_id }}" - ssh_cred_name: "AWX-Collection-tests-tower_ad_hoc_command_wait-ssh-cred-{{ test_id }}" - org_name: "AWX-Collection-tests-tower_ad_hoc_command_wait-org-{{ test_id }}" + inv_name: "AWX-Collection-tests-ad_hoc_command_wait-inventory-{{ test_id }}" + ssh_cred_name: "AWX-Collection-tests-ad_hoc_command_wait-ssh-cred-{{ test_id }}" + org_name: "AWX-Collection-tests-ad_hoc_command_wait-org-{{ test_id }}" - name: Create a New Organization organization: @@ -43,7 +43,7 @@ - assert: that: - result is failed - - "result.msg == 'Unable to wait on ad hoc command 99999999; that ID does not exist in Tower.'" + - "result.msg == 'Unable to wait on ad hoc command 99999999; that ID does not exist.'" - name: Launch command module with sleep 10 ad_hoc_command: diff --git a/awx_collection/tests/integration/targets/application/tasks/main.yml b/awx_collection/tests/integration/targets/application/tasks/main.yml index fadc044cee..ca3c212e03 100644 --- a/awx_collection/tests/integration/targets/application/tasks/main.yml +++ b/awx_collection/tests/integration/targets/application/tasks/main.yml @@ -5,9 +5,9 @@ - name: Generate names set_fact: - app1_name: "AWX-Collection-tests-tower_application-app1-{{ test_id }}" - app2_name: "AWX-Collection-tests-tower_application-app2-{{ test_id }}" - app3_name: "AWX-Collection-tests-tower_application-app3-{{ test_id }}" + app1_name: "AWX-Collection-tests-application-app1-{{ test_id }}" + app2_name: "AWX-Collection-tests-application-app2-{{ test_id }}" + app3_name: "AWX-Collection-tests-application-app3-{{ test_id }}" - block: - name: Create an application diff --git a/awx_collection/tests/integration/targets/credential/tasks/main.yml b/awx_collection/tests/integration/targets/credential/tasks/main.yml index 4b5328330a..cbd23c0c76 100644 --- a/awx_collection/tests/integration/targets/credential/tasks/main.yml +++ b/awx_collection/tests/integration/targets/credential/tasks/main.yml @@ -6,23 +6,23 @@ - name: Generate names set_fact: - ssh_cred_name1: "AWX-Collection-tests-tower_credential-ssh-cred1-{{ test_id }}" - ssh_cred_name2: "AWX-Collection-tests-tower_credential-ssh-cred2-{{ test_id }}" - ssh_cred_name3: "AWX-Collection-tests-tower_credential-ssh-cred-lookup-source-{{ test_id }}" - ssh_cred_name4: "AWX-Collection-tests-tower_credential-ssh-cred-file-source-{{ test_id }}" - vault_cred_name1: "AWX-Collection-tests-tower_credential-vault-cred1-{{ test_id }}" - vault_cred_name2: "AWX-Collection-tests-tower_credential-vault-ssh-cred1-{{ test_id }}" - net_cred_name1: "AWX-Collection-tests-tower_credential-net-cred1-{{ test_id }}" - scm_cred_name1: "AWX-Collection-tests-tower_credential-scm-cred1-{{ test_id }}" - aws_cred_name1: "AWX-Collection-tests-tower_credential-aws-cred1-{{ test_id }}" - vmware_cred_name1: "AWX-Collection-tests-tower_credential-vmware-cred1-{{ test_id }}" - sat6_cred_name1: "AWX-Collection-tests-tower_credential-sat6-cred1-{{ test_id }}" - gce_cred_name1: "AWX-Collection-tests-tower_credential-gce-cred1-{{ test_id }}" - azurerm_cred_name1: "AWX-Collection-tests-tower_credential-azurerm-cred1-{{ test_id }}" - openstack_cred_name1: "AWX-Collection-tests-tower_credential-openstack-cred1-{{ test_id }}" - rhv_cred_name1: "AWX-Collection-tests-tower_credential-rhv-cred1-{{ test_id }}" - insights_cred_name1: "AWX-Collection-tests-tower_credential-insights-cred1-{{ test_id }}" - tower_cred_name1: "AWX-Collection-tests-tower_credential-tower-cred1-{{ test_id }}" + ssh_cred_name1: "AWX-Collection-tests-credential-ssh-cred1-{{ test_id }}" + ssh_cred_name2: "AWX-Collection-tests-credential-ssh-cred2-{{ test_id }}" + ssh_cred_name3: "AWX-Collection-tests-credential-ssh-cred-lookup-source-{{ test_id }}" + ssh_cred_name4: "AWX-Collection-tests-credential-ssh-cred-file-source-{{ test_id }}" + vault_cred_name1: "AWX-Collection-tests-credential-vault-cred1-{{ test_id }}" + vault_cred_name2: "AWX-Collection-tests-credential-vault-ssh-cred1-{{ test_id }}" + net_cred_name1: "AWX-Collection-tests-credential-net-cred1-{{ test_id }}" + scm_cred_name1: "AWX-Collection-tests-credential-scm-cred1-{{ test_id }}" + aws_cred_name1: "AWX-Collection-tests-credential-aws-cred1-{{ test_id }}" + vmware_cred_name1: "AWX-Collection-tests-credential-vmware-cred1-{{ test_id }}" + sat6_cred_name1: "AWX-Collection-tests-credential-sat6-cred1-{{ test_id }}" + gce_cred_name1: "AWX-Collection-tests-credential-gce-cred1-{{ test_id }}" + azurerm_cred_name1: "AWX-Collection-tests-credential-azurerm-cred1-{{ test_id }}" + openstack_cred_name1: "AWX-Collection-tests-credential-openstack-cred1-{{ test_id }}" + rhv_cred_name1: "AWX-Collection-tests-credential-rhv-cred1-{{ test_id }}" + insights_cred_name1: "AWX-Collection-tests-credential-insights-cred1-{{ test_id }}" + tower_cred_name1: "AWX-Collection-tests-credential-tower-cred1-{{ test_id }}" - name: create a tempdir for an SSH key local_action: shell mktemp -d diff --git a/awx_collection/tests/integration/targets/credential_input_source/tasks/main.yml b/awx_collection/tests/integration/targets/credential_input_source/tasks/main.yml index 83fc112e76..03557ee0e1 100644 --- a/awx_collection/tests/integration/targets/credential_input_source/tasks/main.yml +++ b/awx_collection/tests/integration/targets/credential_input_source/tasks/main.yml @@ -6,11 +6,11 @@ - name: Generate names set_fact: - src_cred_name: "AWX-Collection-tests-tower_credential_input_source-src_cred-{{ test_id }}" - target_cred_name: "AWX-Collection-tests-tower_credential_input_source-target_cred-{{ test_id }}" + src_cred_name: "AWX-Collection-tests-credential_input_source-src_cred-{{ test_id }}" + target_cred_name: "AWX-Collection-tests-credential_input_source-target_cred-{{ test_id }}" - block: - - name: Add Tower credential Lookup + - name: Add credential Lookup credential: description: Credential for Testing Source name: "{{ src_cred_name }}" @@ -25,7 +25,7 @@ that: - "src_cred_result is changed" - - name: Add Tower credential Target + - name: Add credential Target credential: description: Credential for Testing Target name: "{{ target_cred_name }}" @@ -54,7 +54,7 @@ that: - "result is changed" - - name: Add Second Tower credential Lookup + - name: Add Second credential Lookup credential: description: Credential for Testing Source Change name: "{{ src_cred_name }}-2" @@ -77,7 +77,7 @@ - "result is changed" always: - - name: Remove a Tower credential source + - name: Remove a credential source credential_input_source: input_field_name: password target_credential: "{{ target_cred_name }}" @@ -88,7 +88,7 @@ that: - "result is changed" - - name: Remove Tower credential Lookup + - name: Remove credential Lookup credential: name: "{{ src_cred_name }}" organization: Default @@ -96,7 +96,7 @@ state: absent register: result - - name: Remove Alt Tower credential Lookup + - name: Remove Alt credential Lookup credential: name: "{{ src_cred_name }}-2" organization: Default @@ -104,7 +104,7 @@ state: absent register: result - - name: Remove Tower credential + - name: Remove credential credential: name: "{{ target_cred_name }}" organization: Default diff --git a/awx_collection/tests/integration/targets/credential_type/tasks/main.yml b/awx_collection/tests/integration/targets/credential_type/tasks/main.yml index bf4bb19933..903cd7d5cc 100644 --- a/awx_collection/tests/integration/targets/credential_type/tasks/main.yml +++ b/awx_collection/tests/integration/targets/credential_type/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: Generate names set_fact: - cred_type_name: "AWX-Collection-tests-tower_credential_type-cred-type-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + cred_type_name: "AWX-Collection-tests-credential_type-cred-type-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - name: Add Tower credential type credential_type: diff --git a/awx_collection/tests/integration/targets/export/tasks/main.yml b/awx_collection/tests/integration/targets/export/tasks/main.yml index be06a0976a..d051b3ee68 100644 --- a/awx_collection/tests/integration/targets/export/tasks/main.yml +++ b/awx_collection/tests/integration/targets/export/tasks/main.yml @@ -6,9 +6,9 @@ - name: Generate names set_fact: - org_name1: "AWX-Collection-tests-tower_export-organization-{{ test_id }}" - org_name2: "AWX-Collection-tests-tower_export-organization2-{{ test_id }}" - inventory_name1: "AWX-Collection-tests-tower_export-inv1-{{ test_id }}" + org_name1: "AWX-Collection-tests-export-organization-{{ test_id }}" + org_name2: "AWX-Collection-tests-export-organization2-{{ test_id }}" + inventory_name1: "AWX-Collection-tests-export-inv1-{{ test_id }}" - block: - name: Create some organizations @@ -23,7 +23,7 @@ name: "{{ inventory_name1 }}" organization: "{{ org_name1 }}" - - name: Export all tower assets + - name: Export all assets export: all: true register: all_assets diff --git a/awx_collection/tests/integration/targets/group/tasks/main.yml b/awx_collection/tests/integration/targets/group/tasks/main.yml index 313cb55ae4..ac58826b17 100644 --- a/awx_collection/tests/integration/targets/group/tasks/main.yml +++ b/awx_collection/tests/integration/targets/group/tasks/main.yml @@ -1,13 +1,13 @@ --- - name: Generate names set_fact: - group_name1: "AWX-Collection-tests-tower_group-group-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - group_name2: "AWX-Collection-tests-tower_group-group-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - group_name3: "AWX-Collection-tests-tower_group-group-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - inv_name: "AWX-Collection-test-tower_group-inv-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - host_name1: "AWX-Collection-test-tower_group-host-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - host_name2: "AWX-Collection-test-tower_group-host-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - host_name3: "AWX-Collection-test-tower_group-host-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + group_name1: "AWX-Collection-tests-group-group-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + group_name2: "AWX-Collection-tests-group-group-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + group_name3: "AWX-Collection-tests-group-group-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + inv_name: "AWX-Collection-tests-group-inv-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + host_name1: "AWX-Collection-tests-group-host-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + host_name2: "AWX-Collection-tests-group-host-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + host_name3: "AWX-Collection-tests-group-host-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - name: Create an Inventory inventory: diff --git a/awx_collection/tests/integration/targets/host/tasks/main.yml b/awx_collection/tests/integration/targets/host/tasks/main.yml index 185412c180..a0321b09cb 100644 --- a/awx_collection/tests/integration/targets/host/tasks/main.yml +++ b/awx_collection/tests/integration/targets/host/tasks/main.yml @@ -1,8 +1,8 @@ --- - name: Generate names set_fact: - host_name: "AWX-Collection-tests-tower_host-host-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - inv_name: "AWX-Collection-tests-tower_host-inv-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + host_name: "AWX-Collection-tests-host-host-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + inv_name: "AWX-Collection-tests-host-inv-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - name: Create an Inventory inventory: diff --git a/awx_collection/tests/integration/targets/import/tasks/main.yml b/awx_collection/tests/integration/targets/import/tasks/main.yml index 818fe4ee3c..9e0ac0fdc3 100644 --- a/awx_collection/tests/integration/targets/import/tasks/main.yml +++ b/awx_collection/tests/integration/targets/import/tasks/main.yml @@ -6,8 +6,8 @@ - name: Generate names set_fact: - org_name1: "AWX-Collection-tests-tower_import-organization-{{ test_id }}" - org_name2: "AWX-Collection-tests-tower_import-organization2-{{ test_id }}" + org_name1: "AWX-Collection-tests-import-organization-{{ test_id }}" + org_name2: "AWX-Collection-tests-import-organization2-{{ test_id }}" - block: - name: "Import something" diff --git a/awx_collection/tests/integration/targets/instance_group/tasks/main.yml b/awx_collection/tests/integration/targets/instance_group/tasks/main.yml index 8d526d7fd7..701137f28c 100644 --- a/awx_collection/tests/integration/targets/instance_group/tasks/main.yml +++ b/awx_collection/tests/integration/targets/instance_group/tasks/main.yml @@ -5,9 +5,9 @@ - name: Generate names set_fact: - group_name1: "AWX-Collection-tests-tower_instance_group-group1-{{ test_id }}" - group_name2: "AWX-Collection-tests-tower_instance_group-group2-{{ test_id }}" - cred_name1: "AWX-Collection-tests-tower_instance_group-cred1-{{ test_id }}" + group_name1: "AWX-Collection-tests-instance_group-group1-{{ test_id }}" + group_name2: "AWX-Collection-tests-instance_group-group2-{{ test_id }}" + cred_name1: "AWX-Collection-tests-instance_group-cred1-{{ test_id }}" - block: - name: Create an OpenShift Credential diff --git a/awx_collection/tests/integration/targets/inventory/tasks/main.yml b/awx_collection/tests/integration/targets/inventory/tasks/main.yml index 0171f9a0b9..0906372c45 100644 --- a/awx_collection/tests/integration/targets/inventory/tasks/main.yml +++ b/awx_collection/tests/integration/targets/inventory/tasks/main.yml @@ -5,10 +5,10 @@ - name: Generate names set_fact: - inv_name1: "AWX-Collection-tests-tower_inventory-inv1-{{ test_id }}" - inv_name2: "AWX-Collection-tests-tower_inventory-inv2-{{ test_id }}" - cred_name1: "AWX-Collection-tests-tower_inventory-cred1-{{ test_id }}" - group_name1: "AWX-Collection-tests-tower_instance_group-group1-{{ test_id }}" + inv_name1: "AWX-Collection-tests-inventory-inv1-{{ test_id }}" + inv_name2: "AWX-Collection-tests-inventory-inv2-{{ test_id }}" + cred_name1: "AWX-Collection-tests-inventory-cred1-{{ test_id }}" + group_name1: "AWX-Collection-tests-instance_group-group1-{{ test_id }}" - block: diff --git a/awx_collection/tests/integration/targets/inventory_source/tasks/main.yml b/awx_collection/tests/integration/targets/inventory_source/tasks/main.yml index 56abbb0afa..a1654bf25b 100644 --- a/awx_collection/tests/integration/targets/inventory_source/tasks/main.yml +++ b/awx_collection/tests/integration/targets/inventory_source/tasks/main.yml @@ -1,11 +1,11 @@ --- - name: Generate names set_fact: - openstack_cred: "AWX-Collection-tests-tower_inventory_source-cred-openstack-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - openstack_inv: "AWX-Collection-tests-tower_inventory_source-inv-openstack-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - openstack_inv_source: "AWX-Collection-tests-tower_inventory_source-inv-source-openstack-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + openstack_cred: "AWX-Collection-tests-inventory_source-cred-openstack-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + openstack_inv: "AWX-Collection-tests-inventory_source-inv-openstack-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + openstack_inv_source: "AWX-Collection-tests-inventory_source-inv-source-openstack-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" -- name: Add a Tower credential +- name: Add a credential credential: description: Credentials for Openstack Test project name: "{{ openstack_cred }}" @@ -18,7 +18,7 @@ domain: test register: credential_result -- name: Add a Tower inventory +- name: Add an inventory inventory: description: Test inventory organization: Default diff --git a/awx_collection/tests/integration/targets/inventory_source_update/tasks/main.yml b/awx_collection/tests/integration/targets/inventory_source_update/tasks/main.yml index 435770302a..8af4d5589c 100644 --- a/awx_collection/tests/integration/targets/inventory_source_update/tasks/main.yml +++ b/awx_collection/tests/integration/targets/inventory_source_update/tasks/main.yml @@ -5,12 +5,12 @@ - name: Generate names set_fact: - project_name: "AWX-Collection-tests-tower_inventory_source_update-project-{{ test_id }}" - inv_name: "AWX-Collection-tests-tower_inventory_source_update-inv-{{ test_id }}" - inv_source1: "AWX-Collection-tests-tower_inventory_source_update-source1-{{ test_id }}" - inv_source2: "AWX-Collection-tests-tower_inventory_source_update-source2-{{ test_id }}" - inv_source3: "AWX-Collection-tests-tower_inventory_source_update-source3-{{ test_id }}" - org_name: "AWX-Collection-tests-tower_inventory_source_update-org-{{ test_id }}" + project_name: "AWX-Collection-tests-inventory_source_update-project-{{ test_id }}" + inv_name: "AWX-Collection-tests-inventory_source_update-inv-{{ test_id }}" + inv_source1: "AWX-Collection-tests-inventory_source_update-source1-{{ test_id }}" + inv_source2: "AWX-Collection-tests-inventory_source_update-source2-{{ test_id }}" + inv_source3: "AWX-Collection-tests-inventory_source_update-source3-{{ test_id }}" + org_name: "AWX-Collection-tests-inventory_source_update-org-{{ test_id }}" - block: diff --git a/awx_collection/tests/integration/targets/job_launch/tasks/main.yml b/awx_collection/tests/integration/targets/job_launch/tasks/main.yml index 9d98c9fe36..178ab84e3e 100644 --- a/awx_collection/tests/integration/targets/job_launch/tasks/main.yml +++ b/awx_collection/tests/integration/targets/job_launch/tasks/main.yml @@ -1,9 +1,9 @@ --- - name: Generate names set_fact: - jt_name1: "AWX-Collection-tests-tower_job_launch-jt1-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - jt_name2: "AWX-Collection-tests-tower_job_launch-jt2-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - proj_name: "AWX-Collection-tests-tower_job_launch-project-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + jt_name1: "AWX-Collection-tests-job_launch-jt1-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + jt_name2: "AWX-Collection-tests-job_launch-jt2-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + proj_name: "AWX-Collection-tests-job_launch-project-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - name: Launch a Job Template job_launch: diff --git a/awx_collection/tests/integration/targets/job_template/tasks/main.yml b/awx_collection/tests/integration/targets/job_template/tasks/main.yml index 7dd1daad86..9cbc5b9c2a 100644 --- a/awx_collection/tests/integration/targets/job_template/tasks/main.yml +++ b/awx_collection/tests/integration/targets/job_template/tasks/main.yml @@ -5,17 +5,17 @@ - name: generate random string for project set_fact: - org_name: "AWX-Collection-tests-tower_organization-org-{{ test_id }}" - cred1: "AWX-Collection-tests-tower_job_template-cred1-{{ test_id }}" - cred2: "AWX-Collection-tests-tower_job_template-cred2-{{ test_id }}" - cred3: "AWX-Collection-tests-tower_job_template-cred3-{{ test_id }}" - proj1: "AWX-Collection-tests-tower_job_template-proj-{{ test_id }}" - jt1: "AWX-Collection-tests-tower_job_template-jt1-{{ test_id }}" - jt2: "AWX-Collection-tests-tower_job_template-jt2-{{ test_id }}" - lab1: "AWX-Collection-tests-tower_job_template-lab1-{{ test_id }}" - email_not: "AWX-Collection-tests-tower_job_template-email-not-{{ test_id }}" - webhook_not: "AWX-Collection-tests-tower_notification_template-wehbook-not-{{ test_id }}" - group_name1: "AWX-Collection-tests-tower_instance_group-group1-{{ test_id }}" + org_name: "AWX-Collection-tests-organization-org-{{ test_id }}" + cred1: "AWX-Collection-tests-job_template-cred1-{{ test_id }}" + cred2: "AWX-Collection-tests-job_template-cred2-{{ test_id }}" + cred3: "AWX-Collection-tests-job_template-cred3-{{ test_id }}" + proj1: "AWX-Collection-tests-job_template-proj-{{ test_id }}" + jt1: "AWX-Collection-tests-job_template-jt1-{{ test_id }}" + jt2: "AWX-Collection-tests-job_template-jt2-{{ test_id }}" + lab1: "AWX-Collection-tests-job_template-lab1-{{ test_id }}" + email_not: "AWX-Collection-tests-job_template-email-not-{{ test_id }}" + webhook_not: "AWX-Collection-tests-notification_template-wehbook-not-{{ test_id }}" + group_name1: "AWX-Collection-tests-instance_group-group1-{{ test_id }}" - name: "Create a new organization" tower_organization: diff --git a/awx_collection/tests/integration/targets/job_wait/tasks/main.yml b/awx_collection/tests/integration/targets/job_wait/tasks/main.yml index 5187dc7da8..1e6afab09c 100644 --- a/awx_collection/tests/integration/targets/job_wait/tasks/main.yml +++ b/awx_collection/tests/integration/targets/job_wait/tasks/main.yml @@ -1,8 +1,8 @@ --- - name: Generate random string for template and project set_fact: - jt_name: "AWX-Collection-tests-tower_job_wait-long_running-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - proj_name: "AWX-Collection-tests-tower_job_wait-long_running-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + jt_name: "AWX-Collection-tests-job_wait-long_running-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + proj_name: "AWX-Collection-tests-job_wait-long_running-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - name: Assure that the demo project exists project: @@ -45,7 +45,7 @@ - assert: that: - - "result.msg =='Unable to wait on job 99999999; that ID does not exist in Tower.' or + - "result.msg =='Unable to wait on job 99999999; that ID does not exist.' or 'min and max interval have been depricated, please use interval instead, interval will be set to 12'" - name: Check module fails with correct msg @@ -58,7 +58,7 @@ that: - result is failed - "result.msg =='Unable to wait, no job_id 99999999 found: The requested object could not be found.' or - 'Unable to wait on job 99999999; that ID does not exist in Tower.'" + 'Unable to wait on job 99999999; that ID does not exist.'" - name: Launch Demo Job Template (take happy path) job_launch: @@ -136,7 +136,7 @@ organization: Default state: absent -# tower workflow wait test +# workflow wait test - name: Generate a random string for test set_fact: test_id1: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" @@ -144,7 +144,7 @@ - name: Generate names set_fact: - wfjt_name2: "AWX-Collection-tests-tower_workflow_launch--wfjt1-{{ test_id1 }}" + wfjt_name2: "AWX-Collection-tests-workflow_launch--wfjt1-{{ test_id1 }}" - name: Create our workflow workflow_job_template: diff --git a/awx_collection/tests/integration/targets/label/tasks/main.yml b/awx_collection/tests/integration/targets/label/tasks/main.yml index fbb4c3e00f..0ac077f8ca 100644 --- a/awx_collection/tests/integration/targets/label/tasks/main.yml +++ b/awx_collection/tests/integration/targets/label/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: Generate names set_fact: - label_name: "AWX-Collection-tests-tower_label-label-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + label_name: "AWX-Collection-tests-label-label-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - name: Create a Label label: diff --git a/awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml b/awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml index b9be9607b0..7ecfa84a8c 100644 --- a/awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml +++ b/awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml @@ -7,21 +7,21 @@ - name: Generate usernames set_fact: usernames: - - "AWX-Collection-tests-tower_api_lookup-user1-{{ test_id }}" - - "AWX-Collection-tests-tower_api_lookup-user2-{{ test_id }}" - - "AWX-Collection-tests-tower_api_lookup-user3-{{ test_id }}" + - "AWX-Collection-tests-api_lookup-user1-{{ test_id }}" + - "AWX-Collection-tests-api_lookup-user2-{{ test_id }}" + - "AWX-Collection-tests-api_lookup-user3-{{ test_id }}" hosts: - - "AWX-Collection-tests-tower_api_lookup-host1-{{ test_id }}" - - "AWX-Collection-tests-tower_api_lookup-host2-{{ test_id }}" - group_name: "AWX-Collection-tests-tower_api_lookup-group1-{{ test_id }}" + - "AWX-Collection-tests-api_lookup-host1-{{ test_id }}" + - "AWX-Collection-tests-api_lookup-host2-{{ test_id }}" + group_name: "AWX-Collection-tests-api_lookup-group1-{{ test_id }}" - name: Get our collection package controller_meta: - register: tower_meta + register: controller_meta - name: Generate the name of our plugin set_fact: - plugin_name: "{{ tower_meta.prefix }}.controller_api" + plugin_name: "{{ controller_meta.prefix }}.controller_api" - name: Create all of our users user: @@ -177,11 +177,11 @@ # DOCS Example Tests - name: Load the UI settings set_fact: - tower_settings: "{{ lookup('awx.awx.controller_api', 'settings/ui') }}" + controller_settings: "{{ lookup('awx.awx.controller_api', 'settings/ui') }}" - assert: that: - - "'CUSTOM_LOGO' in tower_settings" + - "'CUSTOM_LOGO' in controller_settings" - name: Display the usernames of all admin users debug: @@ -205,12 +205,12 @@ role: admin user: "{{ usernames[0] }}" state: absent - register: tower_role_revoke + register: role_revoke when: "query('awx.awx.controller_api', 'users', query_params={ 'username': 'DNE_TESTING' }) | length == 1" - assert: that: - - tower_role_revoke is skipped + - role_revoke is skipped - name: Create an inventory group with all 'foo' hosts group: diff --git a/awx_collection/tests/integration/targets/notification_template/tasks/main.yml b/awx_collection/tests/integration/targets/notification_template/tasks/main.yml index 89514b3598..fdec155d41 100644 --- a/awx_collection/tests/integration/targets/notification_template/tasks/main.yml +++ b/awx_collection/tests/integration/targets/notification_template/tasks/main.yml @@ -1,12 +1,12 @@ --- - name: Generate names set_fact: - slack_not: "AWX-Collection-tests-tower_notification_template-slack-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - webhook_not: "AWX-Collection-tests-tower_notification_template-wehbook-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - email_not: "AWX-Collection-tests-tower_notification_template-email-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - twillo_not: "AWX-Collection-tests-tower_notification_template-twillo-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - pd_not: "AWX-Collection-tests-tower_notification_template-pd-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - irc_not: "AWX-Collection-tests-tower_notification_template-irc-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + slack_not: "AWX-Collection-tests-notification_template-slack-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + webhook_not: "AWX-Collection-tests-notification_template-wehbook-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + email_not: "AWX-Collection-tests-notification_template-email-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + twillo_not: "AWX-Collection-tests-notification_template-twillo-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + pd_not: "AWX-Collection-tests-notification_template-pd-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + irc_not: "AWX-Collection-tests-notification_template-irc-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - name: Test deprecation warnings with legacy name notification_template: diff --git a/awx_collection/tests/integration/targets/organization/tasks/main.yml b/awx_collection/tests/integration/targets/organization/tasks/main.yml index 5769d7c9b9..50e6e7b2d1 100644 --- a/awx_collection/tests/integration/targets/organization/tasks/main.yml +++ b/awx_collection/tests/integration/targets/organization/tasks/main.yml @@ -5,8 +5,8 @@ - name: Generate an org name set_fact: - org_name: "AWX-Collection-tests-tower_organization-org-{{ test_id }}" - group_name1: "AWX-Collection-tests-tower_instance_group-group1-{{ test_id }}" + org_name: "AWX-Collection-tests-organization-org-{{ test_id }}" + group_name1: "AWX-Collection-tests-instance_group-group1-{{ test_id }}" - name: Make sure {{ org_name }} is not there organization: diff --git a/awx_collection/tests/integration/targets/project/tasks/main.yml b/awx_collection/tests/integration/targets/project/tasks/main.yml index 8a6f36ac24..61e51dd887 100644 --- a/awx_collection/tests/integration/targets/project/tasks/main.yml +++ b/awx_collection/tests/integration/targets/project/tasks/main.yml @@ -1,13 +1,13 @@ --- - name: Generate names set_fact: - project_name1: "AWX-Collection-tests-tower_project-project1-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - project_name2: "AWX-Collection-tests-tower_project-project2-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - project_name3: "AWX-Collection-tests-tower_project-project3-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - jt1: "AWX-Collection-tests-tower_project-jt1-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - scm_cred_name: "AWX-Collection-tests-tower_project-scm-cred-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - org_name: "AWX-Collection-tests-tower_project-org-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - cred_name: "AWX-Collection-tests-tower_project-cred-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + project_name1: "AWX-Collection-tests-project-project1-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + project_name2: "AWX-Collection-tests-project-project2-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + project_name3: "AWX-Collection-tests-project-project3-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + jt1: "AWX-Collection-tests-project-jt1-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + scm_cred_name: "AWX-Collection-tests-project-scm-cred-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + org_name: "AWX-Collection-tests-project-org-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + cred_name: "AWX-Collection-tests-project-cred-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - block: - name: Create an SCM Credential @@ -77,7 +77,7 @@ scm_credential: "{{ cred_name }}" check_mode: true - - name: "Copy tower project from {{ project_name1 }}" + - name: "Copy project from {{ project_name1 }}" project: name: "{{ project_name2 }}" copy_from: "{{ project_name1 }}" diff --git a/awx_collection/tests/integration/targets/project_manual/tasks/create_project_dir.yml b/awx_collection/tests/integration/targets/project_manual/tasks/create_project_dir.yml index 44c5648fb3..f59c90ec94 100644 --- a/awx_collection/tests/integration/targets/project_manual/tasks/create_project_dir.yml +++ b/awx_collection/tests/integration/targets/project_manual/tasks/create_project_dir.yml @@ -1,9 +1,9 @@ --- - name: Load the UI settings set_fact: - project_base_dir: "{{ tower_settings.project_base_dir }}" + project_base_dir: "{{ controller_settings.project_base_dir }}" vars: - tower_settings: "{{ lookup('awx.awx.controller_api', 'config/') }}" + controller_settings: "{{ lookup('awx.awx.controller_api', 'config/') }}" - inventory: name: localhost diff --git a/awx_collection/tests/integration/targets/project_update/tasks/main.yml b/awx_collection/tests/integration/targets/project_update/tasks/main.yml index 6859b2405a..4b08e685fe 100644 --- a/awx_collection/tests/integration/targets/project_update/tasks/main.yml +++ b/awx_collection/tests/integration/targets/project_update/tasks/main.yml @@ -6,7 +6,7 @@ - name: Generate names set_fact: - project_name1: "AWX-Collection-tests-tower_project_update-project-{{ test_id }}" + project_name1: "AWX-Collection-tests-project_update-project-{{ test_id }}" - name: Create a git project without credentials without waiting project: diff --git a/awx_collection/tests/integration/targets/role/tasks/main.yml b/awx_collection/tests/integration/targets/role/tasks/main.yml index e2805a2960..364ba67183 100644 --- a/awx_collection/tests/integration/targets/role/tasks/main.yml +++ b/awx_collection/tests/integration/targets/role/tasks/main.yml @@ -5,11 +5,11 @@ - name: Generate names set_fact: - username: "AWX-Collection-tests-tower_role-user-{{ test_id }}" - project_name: "AWX-Collection-tests-tower_role-project-1-{{ test_id }}" - jt1: "AWX-Collection-tests-tower_role-jt1-{{ test_id }}" - jt2: "AWX-Collection-tests-tower_role-jt2-{{ test_id }}" - wfjt_name: "AWX-Collection-tests-tower_role-project-wfjt-{{ test_id }}" + username: "AWX-Collection-tests-role-user-{{ test_id }}" + project_name: "AWX-Collection-tests-role-project-1-{{ test_id }}" + jt1: "AWX-Collection-tests-role-jt1-{{ test_id }}" + jt2: "AWX-Collection-tests-role-jt2-{{ test_id }}" + wfjt_name: "AWX-Collection-tests-role-project-wfjt-{{ test_id }}" - block: - name: Create a User diff --git a/awx_collection/tests/integration/targets/schedule/tasks/main.yml b/awx_collection/tests/integration/targets/schedule/tasks/main.yml index 999df2f768..828cce1faf 100644 --- a/awx_collection/tests/integration/targets/schedule/tasks/main.yml +++ b/awx_collection/tests/integration/targets/schedule/tasks/main.yml @@ -5,7 +5,7 @@ - name: generate random string for project set_fact: - sched1: "AWX-Collection-tests-tower_schedule-sched1-{{ test_id }}" + sched1: "AWX-Collection-tests-schedule-sched1-{{ test_id }}" - name: Try to create without an rrule schedule: diff --git a/awx_collection/tests/integration/targets/schedule_rrule/tasks/main.yml b/awx_collection/tests/integration/targets/schedule_rrule/tasks/main.yml index f7a1b0e2b0..bf416b813d 100644 --- a/awx_collection/tests/integration/targets/schedule_rrule/tasks/main.yml +++ b/awx_collection/tests/integration/targets/schedule_rrule/tasks/main.yml @@ -1,11 +1,11 @@ --- - name: Get our collection package controller_meta: - register: tower_meta + register: controller_meta - name: Generate the name of our plugin set_fact: - plugin_name: "{{ tower_meta.prefix }}.tower_schedule_rrule" + plugin_name: "{{ controller_meta.prefix }}.schedule_rrule" - name: Test too many params (failure from validation of terms) debug: diff --git a/awx_collection/tests/integration/targets/settings/tasks/main.yml b/awx_collection/tests/integration/targets/settings/tasks/main.yml index 993efad588..65ae45c639 100644 --- a/awx_collection/tests/integration/targets/settings/tasks/main.yml +++ b/awx_collection/tests/integration/targets/settings/tasks/main.yml @@ -4,7 +4,7 @@ name: AWX_ISOLATION_SHOW_PATHS value: '["/var/lib/awx/projects/"]' -- name: Set the value of AWX_ISOLATION_SHOW_PATHS to get an error back from Tower +- name: Set the value of AWX_ISOLATION_SHOW_PATHS to get an error back from the controller settings: settings: AWX_ISOLATION_SHOW_PATHS: diff --git a/awx_collection/tests/integration/targets/team/tasks/main.yml b/awx_collection/tests/integration/targets/team/tasks/main.yml index e095d9a543..f220d9194f 100644 --- a/awx_collection/tests/integration/targets/team/tasks/main.yml +++ b/awx_collection/tests/integration/targets/team/tasks/main.yml @@ -1,9 +1,9 @@ --- - name: Generate names set_fact: - team_name: "AWX-Collection-tests-tower_team-team-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + team_name: "AWX-Collection-tests-team-team-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" -- name: Attempt to add a Tower team to a non-existant Organization +- name: Attempt to add a team to a non-existant Organization team: name: Test Team organization: Missing_Organization @@ -11,7 +11,7 @@ register: result ignore_errors: true -- name: Assert a meaningful error was provided for the failed Tower team creation +- name: Assert a meaningful error was provided for the failed team creation assert: that: - "result is failed" @@ -19,7 +19,7 @@ - "'Missing_Organization' in result.msg" - "result.total_results == 0" -- name: Create a Tower team +- name: Create a team team: name: "{{ team_name }}" organization: Default @@ -29,7 +29,7 @@ that: - "result is changed" -- name: Delete a Tower team +- name: Delete a team team: name: "{{ team_name }}" organization: Default diff --git a/awx_collection/tests/integration/targets/token/tasks/main.yml b/awx_collection/tests/integration/targets/token/tasks/main.yml index afbcb84768..144c4d7175 100644 --- a/awx_collection/tests/integration/targets/token/tasks/main.yml +++ b/awx_collection/tests/integration/targets/token/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: Generate names set_fact: - token_description: "AWX-Collection-tests-tower_token-description-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + token_description: "AWX-Collection-tests-token-description-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - name: Try to use a token as a dict which is missing the token parameter job_list: diff --git a/awx_collection/tests/integration/targets/user/tasks/main.yml b/awx_collection/tests/integration/targets/user/tasks/main.yml index 7c17c24ac8..bd5a2c4660 100644 --- a/awx_collection/tests/integration/targets/user/tasks/main.yml +++ b/awx_collection/tests/integration/targets/user/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: Generate names set_fact: - username: "AWX-Collection-tests-tower_user-user-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + username: "AWX-Collection-tests-user-user-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - name: Create a User user: @@ -101,7 +101,7 @@ that: - "result is changed" -- name: Test tower SSL parameter +- name: Test SSL parameter user: first_name: Joe last_name: User diff --git a/awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml b/awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml index b0c7311c79..fd61783266 100644 --- a/awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml +++ b/awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml @@ -5,18 +5,18 @@ - name: Generate random names for test objects set_fact: - org_name: "AWX-Collection-tests-tower_organization-org-{{ test_id }}" - scm_cred_name: "AWX-Collection-tests-tower_workflow_job_template-scm-cred-{{ test_id }}" - demo_project_name: "AWX-Collection-tests-tower_workflow_job_template-proj-{{ test_id }}" - jt1_name: "AWX-Collection-tests-tower_workflow_job_template-jt1-{{ test_id }}" - jt2_name: "AWX-Collection-tests-tower_workflow_job_template-jt2-{{ test_id }}" - approval_node_name: "AWX-Collection-tests-tower_workflow_approval_node-{{ test_id }}" - lab1: "AWX-Collection-tests-tower_job_template-lab1-{{ test_id }}" - wfjt_name: "AWX-Collection-tests-tower_workflow_job_template-wfjt-{{ test_id }}" - email_not: "AWX-Collection-tests-tower_job_template-email-not-{{ test_id }}" - webhook_not: "AWX-Collection-tests-tower_notification_template-wehbook-not-{{ test_id }}" - project_inv: "AWX-Collection-tests-tower_inventory_source-inv-project-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - project_inv_source: "AWX-Collection-tests-tower_inventory_source-inv-source-project-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + org_name: "AWX-Collection-tests-organization-org-{{ test_id }}" + scm_cred_name: "AWX-Collection-tests-workflow_job_template-scm-cred-{{ test_id }}" + demo_project_name: "AWX-Collection-tests-workflow_job_template-proj-{{ test_id }}" + jt1_name: "AWX-Collection-tests-workflow_job_template-jt1-{{ test_id }}" + jt2_name: "AWX-Collection-tests-workflow_job_template-jt2-{{ test_id }}" + approval_node_name: "AWX-Collection-tests-workflow_approval_node-{{ test_id }}" + lab1: "AWX-Collection-tests-job_template-lab1-{{ test_id }}" + wfjt_name: "AWX-Collection-tests-workflow_job_template-wfjt-{{ test_id }}" + email_not: "AWX-Collection-tests-job_template-email-not-{{ test_id }}" + webhook_not: "AWX-Collection-tests-notification_template-wehbook-not-{{ test_id }}" + project_inv: "AWX-Collection-tests-inventory_source-inv-project-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + project_inv_source: "AWX-Collection-tests-inventory_source-inv-source-project-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - name: "Create a new organization" tower_organization: @@ -85,7 +85,7 @@ that: - "result is changed" -- name: Add a Tower inventory +- name: Add an inventory inventory: description: Test inventory organization: Default diff --git a/awx_collection/tests/integration/targets/workflow_launch/tasks/main.yml b/awx_collection/tests/integration/targets/workflow_launch/tasks/main.yml index 7efdaa9332..a328b83801 100644 --- a/awx_collection/tests/integration/targets/workflow_launch/tasks/main.yml +++ b/awx_collection/tests/integration/targets/workflow_launch/tasks/main.yml @@ -6,9 +6,9 @@ - name: Generate names set_fact: - wfjt_name1: "AWX-Collection-tests-tower_workflow_launch--wfjt1-{{ test_id }}" - wfjt_name2: "AWX-Collection-tests-tower_workflow_launch--wfjt1-{{ test_id }}-2" - approval_node_name: "AWX-Collection-tests-tower_workflow_launch_approval_node-{{ test_id }}" + wfjt_name1: "AWX-Collection-tests-workflow_launch--wfjt1-{{ test_id }}" + wfjt_name2: "AWX-Collection-tests-workflow_launch--wfjt1-{{ test_id }}-2" + approval_node_name: "AWX-Collection-tests-workflow_launch_approval_node-{{ test_id }}" - block: @@ -24,7 +24,7 @@ identifier: leaf register: new_node - - name: Connect to Tower server but request an invalid workflow + - name: Connect to controller server but request an invalid workflow workflow_launch: workflow_template: "Does Not Exist" ignore_errors: true @@ -176,7 +176,7 @@ unified_job_template: "Demo Job Template" identifier: leaf - # Test tower_workflow_approval and tower_workflow_node_wait + # Test workflow_approval and workflow_node_wait - name: Create approval node workflow_job_template_node: identifier: approval_test diff --git a/awx_collection/tools/roles/template_galaxy/templates/galaxy.yml.j2 b/awx_collection/tools/roles/template_galaxy/templates/galaxy.yml.j2 index d6e6a2724e..b9bb8e0ccc 100644 --- a/awx_collection/tools/roles/template_galaxy/templates/galaxy.yml.j2 +++ b/awx_collection/tools/roles/template_galaxy/templates/galaxy.yml.j2 @@ -13,7 +13,7 @@ authors: - AWX Project Contributors dependencies: {} -description: Ansible content that interacts with the AWX or Ansible Tower API. +description: Ansible content that interacts with the AWX or Automation Platform Controller API. documentation: https://github.com/ansible/awx/blob/devel/awx_collection/README.md homepage: https://www.ansible.com/ issues: https://github.com/ansible/awx/issues?q=is%3Aissue+label%3Acomponent%3Aawx_collection diff --git a/awx_collection/tools/vars/examples.yml b/awx_collection/tools/vars/examples.yml index a927f970b7..95fe4a3f53 100644 --- a/awx_collection/tools/vars/examples.yml +++ b/awx_collection/tools/vars/examples.yml @@ -1,8 +1,8 @@ --- examples: users: | - - name: Add tower user - tower_user: + - name: Add user + user: username: jdoe password: foobarbaz email: jdoe@example.org @@ -11,8 +11,8 @@ examples: state: present tower_config_file: "~/tower_cli.cfg" - - name: Add tower user as a system administrator - tower_user: + - name: Add user as a system administrator + user: username: jdoe password: foobarbaz email: jdoe@example.org @@ -20,8 +20,8 @@ examples: state: present tower_config_file: "~/tower_cli.cfg" - - name: Add tower user as a system auditor - tower_user: + - name: Add user as a system auditor + user: username: jdoe password: foobarbaz email: jdoe@example.org @@ -29,16 +29,16 @@ examples: state: present tower_config_file: "~/tower_cli.cfg" - - name: Delete tower user - tower_user: + - name: Delete user + user: username: jdoe email: jdoe@example.org state: absent tower_config_file: "~/tower_cli.cfg" job_templates: | - - name: Create tower Ping job template - tower_job_template: + - name: Create Ping job template + job_template: name: "Ping" job_type: "run" inventory: "Local" From 1ade9b3a7daa2b149e28ad08b4247423482539f1 Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Wed, 5 May 2021 23:42:54 -0400 Subject: [PATCH 08/31] various references to tower --- awx_collection/plugins/modules/ad_hoc_command_cancel.py | 2 +- awx_collection/plugins/modules/credential.py | 2 +- awx_collection/plugins/modules/credential_type.py | 4 ++-- awx_collection/plugins/modules/notification_template.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/awx_collection/plugins/modules/ad_hoc_command_cancel.py b/awx_collection/plugins/modules/ad_hoc_command_cancel.py index 147ce838d1..98a0d414cb 100644 --- a/awx_collection/plugins/modules/ad_hoc_command_cancel.py +++ b/awx_collection/plugins/modules/ad_hoc_command_cancel.py @@ -98,7 +98,7 @@ def main(): cancel_page = module.get_endpoint(command['related']['cancel']) if 'json' not in cancel_page or 'can_cancel' not in cancel_page['json']: - module.fail_json(msg="Failed to cancel command, got unexpected response from tower", **{'response': cancel_page}) + module.fail_json(msg="Failed to cancel command, got unexpected response", **{'response': cancel_page}) if not cancel_page['json']['can_cancel']: if fail_if_not_running: diff --git a/awx_collection/plugins/modules/credential.py b/awx_collection/plugins/modules/credential.py index 6675f191cf..5146039928 100644 --- a/awx_collection/plugins/modules/credential.py +++ b/awx_collection/plugins/modules/credential.py @@ -395,7 +395,7 @@ def main(): # End backwards compatability state = module.params.get('state') - # Deprication warnings + # Deprecation warnings for legacy_input in OLD_INPUT_NAMES: if module.params.get(legacy_input) is not None: module.deprecate(msg='{0} parameter has been deprecated, please use inputs instead'.format(legacy_input), version="ansible.tower:4.0.0") diff --git a/awx_collection/plugins/modules/credential_type.py b/awx_collection/plugins/modules/credential_type.py index f9c4d4985a..2174f5432f 100644 --- a/awx_collection/plugins/modules/credential_type.py +++ b/awx_collection/plugins/modules/credential_type.py @@ -42,7 +42,7 @@ options: inputs: description: - >- - Enter inputs using either JSON or YAML syntax. Refer to the + Enter inputs using either JSON or YAML syntax. Refer to the Automation Platform Controler documentation for example syntax. type: dict injectors: @@ -66,7 +66,7 @@ EXAMPLES = ''' name: Nexus description: Credentials type for Nexus kind: cloud - inputs: "{{ lookup('file', 'tower_credential_inputs_nexus.json') }}" + inputs: "{{ lookup('file', 'credential_inputs_nexus.json') }}" injectors: {'extra_vars': {'nexus_credential': 'test' }} state: present validate_certs: false diff --git a/awx_collection/plugins/modules/notification_template.py b/awx_collection/plugins/modules/notification_template.py index c959b89cad..8ea0a8dd23 100644 --- a/awx_collection/plugins/modules/notification_template.py +++ b/awx_collection/plugins/modules/notification_template.py @@ -246,7 +246,7 @@ EXAMPLES = ''' notification_configuration: username: user password: s3cr3t - sender: tower@example.com + sender: controller@example.com recipients: - user1@example.com host: smtp.example.com @@ -286,7 +286,7 @@ EXAMPLES = ''' name: irc notification notification_type: irc notification_configuration: - nickname: tower + nickname: controller password: s3cr3t targets: - user1 From 39b26c8f0e5d08ae8dc80b538b00f7e2905bfe4d Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Thu, 6 May 2021 15:04:52 -0400 Subject: [PATCH 09/31] Added env variable CONTROLLER_HOST, et al. Add awx.awx namespace to the runtime.yml redirects, and added templating task to change to ansible.controller --- awx_collection/meta/runtime.yml | 82 +++++++++---------- .../plugins/inventory/controller.py | 2 +- .../plugins/lookup/controller_api.py | 2 +- .../plugins/module_utils/controller_api.py | 30 +++---- .../plugins/module_utils/controller_module.py | 10 +-- awx_collection/test/awx/test_module_utils.py | 6 +- .../targets/credential/tasks/main.yml | 2 +- .../targets/organization/tasks/main.yml | 2 +- .../roles/template_galaxy/tasks/main.yml | 6 ++ 9 files changed, 75 insertions(+), 67 deletions(-) diff --git a/awx_collection/meta/runtime.yml b/awx_collection/meta/runtime.yml index ff29c22ba7..b8a868a73e 100644 --- a/awx_collection/meta/runtime.yml +++ b/awx_collection/meta/runtime.yml @@ -39,93 +39,93 @@ plugin_routing: redirect: awx.awx.schedule_rrule modules: tower_job_list: - redirect: job_list + redirect: awx.awx.job_list tower_job_launch: - redirect: job_launch + redirect: awx.awx.job_launch tower_workflow_job_template: - redirect: workflow_job_template + redirect: awx.awx.workflow_job_template tower_team: - redirect: team + redirect: awx.awx.team tower_job_wait: - redirect: job_wait + redirect: awx.awx.job_wait tower_application: - redirect: application + redirect: awx.awx.application tower_ad_hoc_command_wait: - redirect: ad_hoc_command_wait + redirect: awx.awx.ad_hoc_command_wait tower_credential: - redirect: credential + redirect: awx.awx.credential tower_label: - redirect: label + redirect: awx.awx.label tower_group: - redirect: group + redirect: awx.awx.group tower_host: - redirect: host + redirect: awx.awx.host tower_schedule: - redirect: schedule + redirect: awx.awx.schedule tower_role: - redirect: role + redirect: awx.awx.role tower_ad_hoc_command: - redirect: ad_hoc_command + redirect: awx.awx.ad_hoc_command tower_execution_environment: - redirect: execution_environment + redirect: awx.awx.execution_environment tower_inventory_source_update: - redirect: inventory_source_update + redirect: awx.awx.inventory_source_update tower_instance_group: - redirect: instance_group + redirect: awx.awx.instance_group tower_settings: - redirect: settings + redirect: awx.awx.settings tower_meta: - redirect: controller_meta + redirect: awx.awx.controller_meta tower_export: - redirect: export + redirect: awx.awx.export tower_ad_hoc_command_cancel: - redirect: ad_hoc_command_cancel + redirect: awx.awx.ad_hoc_command_cancel tower_inventory_source: - redirect: inventory_source + redirect: awx.awx.inventory_source tower_user: - redirect: user + redirect: awx.awx.user tower_workflow_launch: - redirect: workflow_launch + redirect: awx.awx.workflow_launch tower_project: - redirect: project + redirect: awx.awx.project tower_token: - redirect: token + redirect: awx.awx.token tower_credential_type: - redirect: credential_type + redirect: awx.awx.credential_type tower_license: - redirect: license + redirect: awx.awx.license tower_project_update: - redirect: project_update + redirect: awx.awx.project_update tower_notification_template: - redirect: notification_template + redirect: awx.awx.notification_template tower_organization: - redirect: organization + redirect: awx.awx.organization tower_job_template: - redirect: job_template + redirect: awx.awx.job_template tower_workflow_job_template_node: - redirect: workflow_job_template_node + redirect: awx.awx.workflow_job_template_node tower_job_cancel: - redirect: job_cancel + redirect: awx.awx.job_cancel tower_import: - redirect: import + redirect: awx.awx.import tower_credential_input_source: - redirect: credential_input_source + redirect: awx.awx.credential_input_source tower_inventory: - redirect: inventory + redirect: awx.awx.inventory tower_receive: - redirect: receive + redirect: awx.awx.receive deprecation: removal_date: TBD warning_text: see plugin documentation for details tower_send: - redirect: send + redirect: awx.awx.send deprecation: removal_date: TBD warning_text: see plugin documentation for details tower_workflow_template: - redirect: workflow_template + redirect: awx.awx.workflow_template deprecation: removal_date: TBD warning_text: see plugin documentation for details tower_notification: - redirect: notification_template + redirect: awx.awx.notification_template diff --git a/awx_collection/plugins/inventory/controller.py b/awx_collection/plugins/inventory/controller.py index c3d24cd810..6cbdc8f328 100644 --- a/awx_collection/plugins/inventory/controller.py +++ b/awx_collection/plugins/inventory/controller.py @@ -81,7 +81,7 @@ def handle_error(**kwargs): class InventoryModule(BaseInventoryPlugin): NAME = 'awx.awx.controller' # REPLACE - # Stays backward compatible with tower inventory script. + # Stays backward compatible with the inventory script. # If the user supplies '@tower_inventory' as path, the plugin will read from environment variables. no_config_file_supplied = False diff --git a/awx_collection/plugins/lookup/controller_api.py b/awx_collection/plugins/lookup/controller_api.py index 90dcaebfdf..d959d17b8a 100644 --- a/awx_collection/plugins/lookup/controller_api.py +++ b/awx_collection/plugins/lookup/controller_api.py @@ -75,7 +75,7 @@ EXAMPLES = """ - name: Load the UI settings specifying the connection info set_fact: - controller_settings: "{{ lookup('awx.awx.controller_api', 'settings/ui' host='tower.example.com', username='admin', password=my_pass_var, verify_ssl=False) }}" + controller_settings: "{{ lookup('awx.awx.controller_api', 'settings/ui' host='controller.example.com', username='admin', password=my_pass_var, verify_ssl=False) }}" - name: Report the usernames of all users with admin privs debug: diff --git a/awx_collection/plugins/module_utils/controller_api.py b/awx_collection/plugins/module_utils/controller_api.py index b655c261da..61aad6712c 100644 --- a/awx_collection/plugins/module_utils/controller_api.py +++ b/awx_collection/plugins/module_utils/controller_api.py @@ -254,26 +254,28 @@ class ControllerAPIModule(ControllerModule): # In PY2 we get back an HTTPResponse object but PY2 is returning an addinfourl # First try to get the headers in PY3 format and then drop down to PY2. try: - tower_type = response.getheader('X-API-Product-Name', None) - tower_version = response.getheader('X-API-Product-Version', None) + controller_type = response.getheader('X-API-Product-Name', None) + controller_version = response.getheader('X-API-Product-Version', None) except Exception: - tower_type = response.info().getheader('X-API-Product-Name', None) - tower_version = response.info().getheader('X-API-Product-Version', None) + controller_type = response.info().getheader('X-API-Product-Name', None) + controller_version = response.info().getheader('X-API-Product-Version', None) parsed_collection_version = Version(self._COLLECTION_VERSION).version - parsed_tower_version = Version(tower_version).version - if tower_type == 'AWX': + parsed_controller_version = Version(controller_version).version + if controller_type == 'AWX': collection_compare_ver = parsed_collection_version[0] - tower_compare_ver = parsed_tower_version[0] + controller_compare_ver = parsed_controller_version[0] else: collection_compare_ver = "{0}.{1}".format(parsed_collection_version[0], parsed_collection_version[1]) - tower_compare_ver = '{0}.{1}'.format(parsed_tower_version[0], parsed_tower_version[1]) + controller_compare_ver = '{0}.{1}'.format(parsed_controller_version[0], parsed_controller_version[1]) - if self._COLLECTION_TYPE not in self.collection_to_version or self.collection_to_version[self._COLLECTION_TYPE] != tower_type: - self.warn("You are using the {0} version of this collection but connecting to {1}".format(self._COLLECTION_TYPE, tower_type)) - elif collection_compare_ver != tower_compare_ver: + if self._COLLECTION_TYPE not in self.collection_to_version or self.collection_to_version[self._COLLECTION_TYPE] != controller_type: + self.warn("You are using the {0} version of this collection but connecting to {1}".format(self._COLLECTION_TYPE, controller_type)) + elif collection_compare_ver != controller_compare_ver: self.warn( - "You are running collection version {0} but connecting to {2} version {1}".format(self._COLLECTION_VERSION, tower_version, tower_type) + "You are running collection version {0} but connecting to {2} version {1}".format( + self._COLLECTION_VERSION, controller_version, controller_type + ) ) self.version_checked = True @@ -694,10 +696,10 @@ class ControllerAPIModule(ControllerModule): resp = he.read() except Exception as e: resp = 'unknown {0}'.format(e) - self.warn('Failed to release tower token: {0}, response: {1}'.format(he, resp)) + self.warn('Failed to release token: {0}, response: {1}'.format(he, resp)) except (Exception) as e: # Sanity check: Did the server send back some kind of internal error? - self.warn('Failed to release tower token {0}: {1}'.format(self.oauth_token_id, e)) + self.warn('Failed to release token {0}: {1}'.format(self.oauth_token_id, e)) def is_job_done(self, job_status): if job_status in ['new', 'pending', 'waiting', 'running']: diff --git a/awx_collection/plugins/module_utils/controller_module.py b/awx_collection/plugins/module_utils/controller_module.py index 1f2bed7c33..234f75a43b 100644 --- a/awx_collection/plugins/module_utils/controller_module.py +++ b/awx_collection/plugins/module_utils/controller_module.py @@ -32,11 +32,11 @@ class ItemNotDefined(Exception): class ControllerModule(AnsibleModule): url = None AUTH_ARGSPEC = dict( - tower_host=dict(required=False, fallback=(env_fallback, ['TOWER_HOST'])), - tower_username=dict(required=False, fallback=(env_fallback, ['TOWER_USERNAME'])), - tower_password=dict(no_log=True, required=False, fallback=(env_fallback, ['TOWER_PASSWORD'])), - validate_certs=dict(type='bool', aliases=['tower_verify_ssl'], required=False, fallback=(env_fallback, ['TOWER_VERIFY_SSL'])), - tower_oauthtoken=dict(type='raw', no_log=True, required=False, fallback=(env_fallback, ['TOWER_OAUTH_TOKEN'])), + tower_host=dict(required=False, fallback=(env_fallback, ['CONTROLLER_HOST', 'TOWER_HOST'])), + tower_username=dict(required=False, fallback=(env_fallback, ['CONTROLLER_USERNAME', 'TOWER_USERNAME'])), + tower_password=dict(no_log=True, required=False, fallback=(env_fallback, ['CONTROLLER_PASSWORD', 'TOWER_PASSWORD'])), + validate_certs=dict(type='bool', aliases=['tower_verify_ssl'], required=False, fallback=(env_fallback, ['CONTROLLER_VERIFY_SSL', 'TOWER_VERIFY_SSL'])), + tower_oauthtoken=dict(type='raw', no_log=True, required=False, fallback=(env_fallback, ['CONTROLLER_OAUTH_TOKEN', 'TOWER_OAUTH_TOKEN'])), tower_config_file=dict(type='path', required=False, default=None), ) short_params = { diff --git a/awx_collection/test/awx/test_module_utils.py b/awx_collection/test/awx/test_module_utils.py index 000a5e7809..fdfc382f77 100644 --- a/awx_collection/test/awx/test_module_utils.py +++ b/awx_collection/test/awx/test_module_utils.py @@ -10,12 +10,12 @@ from requests.models import Response from unittest import mock awx_name = 'AWX' -tower_name = 'Red Hat Automation Platform Controller' +controller_name = 'Red Hat Automation Platform Controller' ping_version = '1.2.3' def getTowerheader(self, header_name, default): - mock_headers = {'X-API-Product-Name': tower_name, 'X-API-Product-Version': ping_version} + mock_headers = {'X-API-Product-Name': controller_name, 'X-API-Product-Version': ping_version} return mock_headers.get(header_name, default) @@ -107,7 +107,7 @@ def test_version_warning_strictness_controller(collection_import, silence_warnin my_module._COLLECTION_TYPE = "controller" my_module.get_endpoint('ping') silence_warning.assert_called_once_with( - 'You are running collection version {0} but connecting to {1} version {2}'.format(my_module._COLLECTION_VERSION, tower_name, ping_version) + 'You are running collection version {0} but connecting to {1} version {2}'.format(my_module._COLLECTION_VERSION, controller_name, ping_version) ) diff --git a/awx_collection/tests/integration/targets/credential/tasks/main.yml b/awx_collection/tests/integration/targets/credential/tasks/main.yml index cbd23c0c76..dda9c4d4cf 100644 --- a/awx_collection/tests/integration/targets/credential/tasks/main.yml +++ b/awx_collection/tests/integration/targets/credential/tasks/main.yml @@ -695,7 +695,7 @@ organization: Default state: present kind: tower - host: https://tower.example.org + host: https://controller.example.org username: joe password: secret register: result diff --git a/awx_collection/tests/integration/targets/organization/tasks/main.yml b/awx_collection/tests/integration/targets/organization/tasks/main.yml index 50e6e7b2d1..a27054a072 100644 --- a/awx_collection/tests/integration/targets/organization/tasks/main.yml +++ b/awx_collection/tests/integration/targets/organization/tasks/main.yml @@ -90,7 +90,7 @@ that: - "result is not changed" -# Test behaviour common to all tower modules +# Test behaviour common to all controller modules - name: Check that SSL is available and verify_ssl is enabled (task must fail) organization: name: Default diff --git a/awx_collection/tools/roles/template_galaxy/tasks/main.yml b/awx_collection/tools/roles/template_galaxy/tasks/main.yml index 99f3356a47..0e3f0630a9 100644 --- a/awx_collection/tools/roles/template_galaxy/tasks/main.yml +++ b/awx_collection/tools/roles/template_galaxy/tasks/main.yml @@ -34,6 +34,12 @@ regexp: "^ NAME = 'awx.awx.controller' # REPLACE$" replace: " NAME = '{{ collection_namespace }}.{{ collection_package }}.controller' # REPLACE" + - name: Change runtime.yml redirect destinations + replace: + path: "{{ collection_path}}/meta/runtime.yml" + regexp: "redirect: awx.awx." + replace: "redirect: '{{ collection_namespace }}.{{ collection_package }}." + - name: get list of test files find: paths: "{{ collection_path }}/tests/integration/targets/" From a7b29f6112ca83a64dc1ddfd9584e259d03ed8d9 Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Mon, 10 May 2021 13:54:33 -0400 Subject: [PATCH 10/31] controller_inventory.yml in addition to tower_inventory.yml --- awx_collection/plugins/inventory/controller.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/awx_collection/plugins/inventory/controller.py b/awx_collection/plugins/inventory/controller.py index 6cbdc8f328..fa5d09cfd2 100644 --- a/awx_collection/plugins/inventory/controller.py +++ b/awx_collection/plugins/inventory/controller.py @@ -82,15 +82,26 @@ def handle_error(**kwargs): class InventoryModule(BaseInventoryPlugin): NAME = 'awx.awx.controller' # REPLACE # Stays backward compatible with the inventory script. - # If the user supplies '@tower_inventory' as path, the plugin will read from environment variables. + # If the user supplies '@controller_inventory' as path, the plugin will read from environment variables. no_config_file_supplied = False def verify_file(self, path): - if path.endswith('@tower_inventory'): + if path.endswith('@controller_inventory') or path.endswith('@tower_inventory'): self.no_config_file_supplied = True return True elif super(InventoryModule, self).verify_file(path): - return path.endswith(('tower_inventory.yml', 'tower_inventory.yaml', 'tower.yml', 'tower.yaml')) + return path.endswith( + ( + 'controller_inventory.yml', + 'controller_inventory.yaml', + 'controller.yml', + 'controller.yaml', + 'tower_inventory.yml', + 'tower_inventory.yaml', + 'tower.yml', + 'tower.yaml', + ) + ) else: return False From 1a2e56c785d3c1051e3f05bcd4d964ca2359e365 Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Tue, 11 May 2021 20:15:54 -0400 Subject: [PATCH 11/31] restore tower_legacy.py, update examples to include CONTROLLER_HOST --- .../plugins/doc_fragments/auth_legacy.py | 16 ++++++------ .../plugins/inventory/controller.py | 26 +++++++++---------- .../plugins/module_utils/tower_legacy.py | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/awx_collection/plugins/doc_fragments/auth_legacy.py b/awx_collection/plugins/doc_fragments/auth_legacy.py index 9ce9aab82b..29c91507f2 100644 --- a/awx_collection/plugins/doc_fragments/auth_legacy.py +++ b/awx_collection/plugins/doc_fragments/auth_legacy.py @@ -10,28 +10,28 @@ __metaclass__ = type class ModuleDocFragment(object): - # Automation Platform Controller documentation fragment + # Ansible Tower documentation fragment DOCUMENTATION = r''' options: tower_host: description: - - URL to your Automation Platform Controller instance. + - URL to your Tower or AWX instance. - If value not set, will try environment variable C(TOWER_HOST) and then config files - If value not specified by any means, the value of C(127.0.0.1) will be used type: str tower_username: description: - - Username for your controller instance. + - Username for your Tower or AWX instance. - If value not set, will try environment variable C(TOWER_USERNAME) and then config files type: str tower_password: description: - - Password for your controller instance. + - Password for your Tower or AWX instance. - If value not set, will try environment variable C(TOWER_PASSWORD) and then config files type: str validate_certs: description: - - Whether to allow insecure connections. + - Whether to allow insecure connections to Tower or AWX. - If C(no), SSL certificates will not be validated. - This should only be used on personally controlled sites using self-signed certificates. - If value not set, will try environment variable C(TOWER_VERIFY_SSL) and then config files @@ -39,14 +39,14 @@ options: aliases: [ tower_verify_ssl ] tower_config_file: description: - - Path to the controller config file. + - Path to the Tower or AWX config file. - If provided, the other locations for config files will not be considered. type: path notes: - If no I(config_file) is provided we will attempt to use the tower-cli library - defaults to find your host information. -- I(config_file) should be in the following format + defaults to find your Tower host information. +- I(config_file) should contain Tower configuration in the following format host=hostname username=username password=password diff --git a/awx_collection/plugins/inventory/controller.py b/awx_collection/plugins/inventory/controller.py index fa5d09cfd2..f5719a579a 100644 --- a/awx_collection/plugins/inventory/controller.py +++ b/awx_collection/plugins/inventory/controller.py @@ -15,10 +15,10 @@ short_description: Ansible dynamic inventory plugin for the Automation Platform description: - Reads inventories from the Automation Platform Controller. - Supports reading configuration from both YAML config file and environment variables. - - If reading from the YAML file, the file name must end with tower.(yml|yaml) or tower_inventory.(yml|yaml), - the path in the command would be /path/to/tower_inventory.(yml|yaml). If some arguments in the config file + - If reading from the YAML file, the file name must end with controller.(yml|yaml) or controller_inventory.(yml|yaml), + the path in the command would be /path/to/controller_inventory.(yml|yaml). If some arguments in the config file are missing, this plugin will try to fill in missing arguments by reading from environment variables. - - If reading configurations from environment variables, the path in the command must be @tower_inventory. + - If reading configurations from environment variables, the path in the command must be @controller_inventory. extends_documentation_fragment: awx.awx.auth_plugin options: inventory_id: @@ -29,7 +29,7 @@ options: - Named URL slugs follow the syntax of "inventory_name++organization_name". type: raw env: - - name: TOWER_INVENTORY + - name: CONTROLLER_INVENTORY required: True include_metadata: description: Make extra requests to provide all group vars with metadata about the source host. @@ -41,7 +41,7 @@ EXAMPLES = ''' # Before you execute the following commands, you should make sure this file is in your plugin path, # and you enabled this plugin. -# Example for using tower_inventory.yml file +# Example for using controller_inventory.yml file plugin: awx.awx.controller host: your_automation_controller_server_network_address @@ -50,18 +50,18 @@ password: your_automation_controller_password inventory_id: the_ID_of_targeted_automation_controller_inventory # Then you can run the following command. # If some of the arguments are missing, Ansible will attempt to read them from environment variables. -# ansible-inventory -i /path/to/tower_inventory.yml --list +# ansible-inventory -i /path/to/controller_inventory.yml --list # Example for reading from environment variables: # Set environment variables: -# export TOWER_HOST=YOUR_TOWER_HOST_ADDRESS -# export TOWER_USERNAME=YOUR_TOWER_USERNAME -# export TOWER_PASSWORD=YOUR_TOWER_PASSWORD -# export TOWER_INVENTORY=THE_ID_OF_TARGETED_INVENTORY -# Read the inventory specified in TOWER_INVENTORY from the controller, and list them. -# The inventory path must always be @tower_inventory if you are reading all settings from environment variables. -# ansible-inventory -i @tower_inventory --list +# export CONTROLLER_HOST=YOUR_AUTOMATION_PLATFORM_CONTROLLER_HOST_ADDRESS +# export CONTROLLER_USERNAME=YOUR_CONTROLLER_USERNAME +# export CONTROLLER_PASSWORD=YOUR_CONTROLLER_PASSWORD +# export CONTROLLER_INVENTORY=THE_ID_OF_TARGETED_INVENTORY +# Read the inventory specified in CONTROLLER_INVENTORY from the controller, and list them. +# The inventory path must always be @controller_inventory if you are reading all settings from environment variables. +# ansible-inventory -i @controller_inventory --list ''' import os diff --git a/awx_collection/plugins/module_utils/tower_legacy.py b/awx_collection/plugins/module_utils/tower_legacy.py index e184ac0f05..faed980a8a 100644 --- a/awx_collection/plugins/module_utils/tower_legacy.py +++ b/awx_collection/plugins/module_utils/tower_legacy.py @@ -83,7 +83,7 @@ def tower_auth_config(module): def tower_check_mode(module): - '''Execute check mode logic for Automation Platform Controller modules''' + '''Execute check mode logic for Ansible Tower modules''' if module.check_mode: try: result = client.get('/ping').json() From 7d06fc74dd31d77b62ea42077f2332df5008bfea Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Thu, 13 May 2021 13:54:37 -0400 Subject: [PATCH 12/31] tower_username to controller_username, etc --- awx_collection/plugins/doc_fragments/auth.py | 25 ++++++----- .../plugins/doc_fragments/auth_plugin.py | 10 ++--- .../plugins/module_utils/controller_module.py | 44 +++++++++---------- awx_collection/plugins/modules/credential.py | 8 ++-- awx_collection/plugins/modules/group.py | 2 +- awx_collection/plugins/modules/host.py | 2 +- awx_collection/plugins/modules/inventory.py | 2 +- awx_collection/plugins/modules/job_list.py | 2 +- .../plugins/modules/job_template.py | 2 +- .../plugins/modules/notification_template.py | 14 +++--- .../plugins/modules/organization.py | 6 +-- awx_collection/plugins/modules/project.py | 4 +- awx_collection/plugins/modules/receive.py | 2 +- awx_collection/plugins/modules/send.py | 2 +- awx_collection/plugins/modules/team.py | 2 +- awx_collection/plugins/modules/token.py | 20 ++++----- awx_collection/plugins/modules/user.py | 8 ++-- awx_collection/test/awx/test_module_utils.py | 8 ++-- awx_collection/test/awx/test_organization.py | 10 ++--- awx_collection/test/awx/test_token.py | 10 ++--- .../targets/job_template/tasks/main.yml | 6 +-- .../integration/targets/token/tasks/main.yml | 24 +++++----- .../integration/targets/user/tasks/main.yml | 4 +- .../workflow_job_template/tasks/main.yml | 6 +-- .../roles/template_galaxy/tasks/main.yml | 4 +- 25 files changed, 116 insertions(+), 111 deletions(-) diff --git a/awx_collection/plugins/doc_fragments/auth.py b/awx_collection/plugins/doc_fragments/auth.py index 90869d1159..52fec785c3 100644 --- a/awx_collection/plugins/doc_fragments/auth.py +++ b/awx_collection/plugins/doc_fragments/auth.py @@ -13,44 +13,49 @@ class ModuleDocFragment(object): # Automation Platform Controller documentation fragment DOCUMENTATION = r''' options: - tower_host: + controller_host: description: - URL to your Automation Platform Controller instance. - - If value not set, will try environment variable C(TOWER_HOST) and then config files + - If value not set, will try environment variable C(CONTROLLER_HOST) and then config files - If value not specified by any means, the value of C(127.0.0.1) will be used type: str - tower_username: + aliases: [ tower_host ] + controller_username: description: - Username for your controller instance. - - If value not set, will try environment variable C(TOWER_USERNAME) and then config files + - If value not set, will try environment variable C(CONTROLLER_USERNAME) and then config files type: str - tower_password: + aliases: [ tower_username ] + controller_password: description: - Password for your controller instance. - - If value not set, will try environment variable C(TOWER_PASSWORD) and then config files + - If value not set, will try environment variable C(CONTROLLER_PASSWORD) and then config files type: str - tower_oauthtoken: + aliases: [ tower_password ] + controller_oauthtoken: description: - The OAuth token to use. - This value can be in one of two formats. - A string which is the token itself. (i.e. bqV5txm97wqJqtkxlMkhQz0pKhRMMX) - A dictionary structure as returned by the token module. - - If value not set, will try environment variable C(TOWER_OAUTH_TOKEN) and then config files + - If value not set, will try environment variable C(CONTROLLER_OAUTH_TOKEN) and then config files type: raw version_added: "3.7" + aliases: [ tower_oauthtoken ] validate_certs: description: - Whether to allow insecure connections to AWX. - If C(no), SSL certificates will not be validated. - This should only be used on personally controlled sites using self-signed certificates. - - If value not set, will try environment variable C(TOWER_VERIFY_SSL) and then config files + - If value not set, will try environment variable C(CONTROLLER_VERIFY_SSL) and then config files type: bool aliases: [ tower_verify_ssl ] - tower_config_file: + controller_config_file: description: - Path to the controller config file. - If provided, the other locations for config files will not be considered. type: path + aliases: [tower_config_file] notes: - If no I(config_file) is provided we will attempt to use the tower-cli library diff --git a/awx_collection/plugins/doc_fragments/auth_plugin.py b/awx_collection/plugins/doc_fragments/auth_plugin.py index 06214bdcc6..0243d2069e 100644 --- a/awx_collection/plugins/doc_fragments/auth_plugin.py +++ b/awx_collection/plugins/doc_fragments/auth_plugin.py @@ -16,27 +16,27 @@ options: host: description: The network address of your Automation Platform Controller host. env: - - name: TOWER_HOST + - name: CONTROLLER_HOST username: description: The user that you plan to use to access inventories on the controller. env: - - name: TOWER_USERNAME + - name: CONTROLLER_USERNAME password: description: The password for your controller user. env: - - name: TOWER_PASSWORD + - name: CONTROLLER_PASSWORD oauth_token: description: - The OAuth token to use. env: - - name: TOWER_OAUTH_TOKEN + - name: CONTROLLER_OAUTH_TOKEN verify_ssl: description: - Specify whether Ansible should verify the SSL certificate of the controller host. - Defaults to True, but this is handled by the shared module_utils code type: bool env: - - name: TOWER_VERIFY_SSL + - name: CONTROLLER_VERIFY_SSL aliases: [ validate_certs ] notes: diff --git a/awx_collection/plugins/module_utils/controller_module.py b/awx_collection/plugins/module_utils/controller_module.py index 234f75a43b..032c3c5b27 100644 --- a/awx_collection/plugins/module_utils/controller_module.py +++ b/awx_collection/plugins/module_utils/controller_module.py @@ -32,19 +32,19 @@ class ItemNotDefined(Exception): class ControllerModule(AnsibleModule): url = None AUTH_ARGSPEC = dict( - tower_host=dict(required=False, fallback=(env_fallback, ['CONTROLLER_HOST', 'TOWER_HOST'])), - tower_username=dict(required=False, fallback=(env_fallback, ['CONTROLLER_USERNAME', 'TOWER_USERNAME'])), - tower_password=dict(no_log=True, required=False, fallback=(env_fallback, ['CONTROLLER_PASSWORD', 'TOWER_PASSWORD'])), + controller_host=dict(required=False, fallback=(env_fallback, ['CONTROLLER_HOST', 'TOWER_HOST'])), + controller_username=dict(required=False, fallback=(env_fallback, ['CONTROLLER_USERNAME', 'TOWER_USERNAME'])), + controller_password=dict(no_log=True, required=False, fallback=(env_fallback, ['CONTROLLER_PASSWORD', 'TOWER_PASSWORD'])), validate_certs=dict(type='bool', aliases=['tower_verify_ssl'], required=False, fallback=(env_fallback, ['CONTROLLER_VERIFY_SSL', 'TOWER_VERIFY_SSL'])), - tower_oauthtoken=dict(type='raw', no_log=True, required=False, fallback=(env_fallback, ['CONTROLLER_OAUTH_TOKEN', 'TOWER_OAUTH_TOKEN'])), - tower_config_file=dict(type='path', required=False, default=None), + controller_oauthtoken=dict(type='raw', no_log=True, required=False, fallback=(env_fallback, ['CONTROLLER_OAUTH_TOKEN', 'TOWER_OAUTH_TOKEN'])), + controller_config_file=dict(type='path', required=False, default=None), ) short_params = { - 'host': 'tower_host', - 'username': 'tower_username', - 'password': 'tower_password', + 'host': 'controller_host', + 'username': 'controller_username', + 'password': 'controller_password', 'verify_ssl': 'validate_certs', - 'oauth_token': 'tower_oauthtoken', + 'oauth_token': 'controller_oauthtoken', } host = '127.0.0.1' username = None @@ -82,18 +82,18 @@ class ControllerModule(AnsibleModule): if direct_value is not None: setattr(self, short_param, direct_value) - # Perform magic depending on whether tower_oauthtoken is a string or a dict - if self.params.get('tower_oauthtoken'): - token_param = self.params.get('tower_oauthtoken') + # Perform magic depending on whether controller_oauthtoken is a string or a dict + if self.params.get('controller_oauthtoken'): + token_param = self.params.get('controller_oauthtoken') if type(token_param) is dict: if 'token' in token_param: - self.oauth_token = self.params.get('tower_oauthtoken')['token'] + self.oauth_token = self.params.get('controller_oauthtoken')['token'] else: - self.fail_json(msg="The provided dict in tower_oauthtoken did not properly contain the token entry") + self.fail_json(msg="The provided dict in controller_oauthtoken did not properly contain the token entry") elif isinstance(token_param, string_types): - self.oauth_token = self.params.get('tower_oauthtoken') + self.oauth_token = self.params.get('controller_oauthtoken') else: - error_msg = "The provided tower_oauthtoken type was not valid ({0}). Valid options are str or dict.".format(type(token_param).__name__) + error_msg = "The provided controller_oauthtoken type was not valid ({0}). Valid options are str or dict.".format(type(token_param).__name__) self.fail_json(msg=error_msg) # Perform some basic validation @@ -104,14 +104,14 @@ class ControllerModule(AnsibleModule): try: self.url = urlparse(self.host) except Exception as e: - self.fail_json(msg="Unable to parse tower_host as a URL ({1}): {0}".format(self.host, e)) + self.fail_json(msg="Unable to parse controller_host as a URL ({1}): {0}".format(self.host, e)) # Try to resolve the hostname hostname = self.url.netloc.split(':')[0] try: gethostbyname(hostname) except Exception as e: - self.fail_json(msg="Unable to resolve tower_host ({1}): {0}".format(hostname, e)) + self.fail_json(msg="Unable to resolve controller_host ({1}): {0}".format(hostname, e)) def build_url(self, endpoint, query_params=None): # Make sure we start with /api/vX @@ -140,18 +140,18 @@ class ControllerModule(AnsibleModule): config_files.insert(2, join(local_dir, ".{0}".format(self.config_name))) # If we have a specified tower config, load it - if self.params.get('tower_config_file'): - duplicated_params = [fn for fn in self.AUTH_ARGSPEC if fn != 'tower_config_file' and self.params.get(fn) is not None] + if self.params.get('controller_config_file'): + duplicated_params = [fn for fn in self.AUTH_ARGSPEC if fn != 'controller_config_file' and self.params.get(fn) is not None] if duplicated_params: self.warn( ( - 'The parameter(s) {0} were provided at the same time as tower_config_file. ' + 'The parameter(s) {0} were provided at the same time as controller_config_file. ' 'Precedence may be unstable, we suggest either using config file or params.' ).format(', '.join(duplicated_params)) ) try: # TODO: warn if there are conflicts with other params - self.load_config(self.params.get('tower_config_file')) + self.load_config(self.params.get('controller_config_file')) except ConfigFileException as cfe: # Since we were told specifically to load this we want it to fail if we have an error self.fail_json(msg=cfe) diff --git a/awx_collection/plugins/modules/credential.py b/awx_collection/plugins/modules/credential.py index 5146039928..a32d656654 100644 --- a/awx_collection/plugins/modules/credential.py +++ b/awx_collection/plugins/modules/credential.py @@ -210,7 +210,7 @@ EXAMPLES = ''' organization: test-org credential_type: Machine state: present - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" - name: Create a valid SCM credential from a private_key file credential: @@ -244,9 +244,9 @@ EXAMPLES = ''' name: Workshop Credential credential_type: MyCloudCredential organization: Default - tower_username: admin - tower_password: ansible - tower_host: https://localhost + controller_username: admin + controller_password: ansible + controller_host: https://localhost - name: Create a Vaiult credential (example for notes) credential: diff --git a/awx_collection/plugins/modules/group.py b/awx_collection/plugins/modules/group.py index 752fe4891a..91b22f56ad 100644 --- a/awx_collection/plugins/modules/group.py +++ b/awx_collection/plugins/modules/group.py @@ -84,7 +84,7 @@ EXAMPLES = ''' description: "Local Host Group" inventory: "Local Inventory" state: present - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" - name: Add group group: diff --git a/awx_collection/plugins/modules/host.py b/awx_collection/plugins/modules/host.py index ee7f6899b1..8e1490f423 100644 --- a/awx_collection/plugins/modules/host.py +++ b/awx_collection/plugins/modules/host.py @@ -65,7 +65,7 @@ EXAMPLES = ''' description: "Local Host Group" inventory: "Local Inventory" state: present - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" variables: example_var: 123 ''' diff --git a/awx_collection/plugins/modules/inventory.py b/awx_collection/plugins/modules/inventory.py index 8b63983b3f..5778aadaba 100644 --- a/awx_collection/plugins/modules/inventory.py +++ b/awx_collection/plugins/modules/inventory.py @@ -83,7 +83,7 @@ EXAMPLES = ''' description: "Our Foo Cloud Servers" organization: "Bar Org" state: present - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" - name: Copy inventory inventory: diff --git a/awx_collection/plugins/modules/job_list.py b/awx_collection/plugins/modules/job_list.py index 61cf6c3418..95f9ea6f37 100644 --- a/awx_collection/plugins/modules/job_list.py +++ b/awx_collection/plugins/modules/job_list.py @@ -48,7 +48,7 @@ EXAMPLES = ''' job_list: status: running query: {"playbook": "testing.yml"} - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" register: testing_jobs ''' diff --git a/awx_collection/plugins/modules/job_template.py b/awx_collection/plugins/modules/job_template.py index 2bae27bb64..52010b48b7 100644 --- a/awx_collection/plugins/modules/job_template.py +++ b/awx_collection/plugins/modules/job_template.py @@ -315,7 +315,7 @@ EXAMPLES = ''' credentials: - "Local" state: "present" - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" survey_enabled: yes survey_spec: "{{ lookup('file', 'my_survey.json') }}" diff --git a/awx_collection/plugins/modules/notification_template.py b/awx_collection/plugins/modules/notification_template.py index 8ea0a8dd23..bc3b9b7f19 100644 --- a/awx_collection/plugins/modules/notification_template.py +++ b/awx_collection/plugins/modules/notification_template.py @@ -226,7 +226,7 @@ EXAMPLES = ''' error: message: "{{ '{{ job_friendly_name }} FAILED! Please look at {{ job.url }}' }}" state: present - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" - name: Add webhook notification notification_template: @@ -237,7 +237,7 @@ EXAMPLES = ''' headers: X-Custom-Header: value123 state: present - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" - name: Add email notification notification_template: @@ -254,7 +254,7 @@ EXAMPLES = ''' use_tls: no use_ssl: no state: present - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" - name: Add twilio notification notification_template: @@ -267,7 +267,7 @@ EXAMPLES = ''' to_numbers: - '+15553334444' state: present - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" - name: Add PagerDuty notification notification_template: @@ -279,7 +279,7 @@ EXAMPLES = ''' client_name: client service_key: a_key state: present - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" - name: Add IRC notification notification_template: @@ -294,13 +294,13 @@ EXAMPLES = ''' server: irc.example.com use_ssl: no state: present - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" - name: Delete notification notification_template: name: old notification state: absent - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" - name: Copy webhook notification notification_template: diff --git a/awx_collection/plugins/modules/organization.py b/awx_collection/plugins/modules/organization.py index fd45452509..c9547de77c 100644 --- a/awx_collection/plugins/modules/organization.py +++ b/awx_collection/plugins/modules/organization.py @@ -91,14 +91,14 @@ EXAMPLES = ''' name: "Foo" description: "Foo bar organization" state: present - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" - name: Create organization using 'foo-venv' as default Python virtualenv organization: name: "Foo" description: "Foo bar organization using foo-venv" state: present - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" - name: Create organization that pulls content from galaxy.ansible.com organization: @@ -106,7 +106,7 @@ EXAMPLES = ''' state: present galaxy_credentials: - Ansible Galaxy - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" ''' from ..module_utils.controller_api import ControllerAPIModule diff --git a/awx_collection/plugins/modules/project.py b/awx_collection/plugins/modules/project.py index 0f6f68ce2c..f01fb9f034 100644 --- a/awx_collection/plugins/modules/project.py +++ b/awx_collection/plugins/modules/project.py @@ -176,7 +176,7 @@ EXAMPLES = ''' description: "Foo bar project" organization: "test" state: present - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" - name: Add Project with cache timeout project: @@ -186,7 +186,7 @@ EXAMPLES = ''' scm_update_on_launch: True scm_update_cache_timeout: 60 state: present - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" - name: Copy project project: diff --git a/awx_collection/plugins/modules/receive.py b/awx_collection/plugins/modules/receive.py index e941b648ec..4463355525 100644 --- a/awx_collection/plugins/modules/receive.py +++ b/awx_collection/plugins/modules/receive.py @@ -104,7 +104,7 @@ EXAMPLES = ''' - name: Export all Automation Platform Controller assets receive: all: True - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" - name: Export all inventories receive: diff --git a/awx_collection/plugins/modules/send.py b/awx_collection/plugins/modules/send.py index 2f5588a7e9..7bff90ea64 100644 --- a/awx_collection/plugins/modules/send.py +++ b/awx_collection/plugins/modules/send.py @@ -65,7 +65,7 @@ EXAMPLES = ''' - name: Import all Automation Platform Controller assets send: assets: "{{ export_output.assets }}" - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" ''' RETURN = ''' diff --git a/awx_collection/plugins/modules/team.py b/awx_collection/plugins/modules/team.py index e66d541e8a..5482b4c850 100644 --- a/awx_collection/plugins/modules/team.py +++ b/awx_collection/plugins/modules/team.py @@ -56,7 +56,7 @@ EXAMPLES = ''' description: Team Description organization: test-org state: present - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" ''' from ..module_utils.controller_api import ControllerAPIModule diff --git a/awx_collection/plugins/modules/token.py b/awx_collection/plugins/modules/token.py index c49c4f8f67..26da2d3f5f 100644 --- a/awx_collection/plugins/modules/token.py +++ b/awx_collection/plugins/modules/token.py @@ -22,7 +22,7 @@ description: - Create or destroy Automation Platform Controller tokens. See U(https://www.ansible.com/tower) for an overview. - In addition, the module sets an Ansible fact which can be passed into other - controller modules as the parameter tower_oauthtoken. See examples for usage. + controller modules as the parameter controller_oauthtoken. See examples for usage. - Because of the sensitive nature of tokens, the created token value is only available once through the Ansible fact. (See RETURN for details) - Due to the nature of tokens this module is not idempotent. A second will @@ -49,7 +49,7 @@ options: default: 'write' choices: ["read", "write"] existing_token: - description: The data structure produced from tower_token in create mode to be used with state absent. + description: The data structure produced from token in create mode to be used with state absent. type: dict existing_token_id: description: A token ID (number) which can be used to delete an arbitrary token with state absent. @@ -70,11 +70,11 @@ EXAMPLES = ''' description: '{{ token_description }}' scope: "write" state: present - tower_oauthtoken: "{{ my_existing_token }}" + controller_oauthtoken: "{{ my_existing_token }}" - name: Delete this token token: - existing_token: "{{ tower_token }}" + existing_token: "{{ token }}" state: absent - name: Create a new token using username/password @@ -82,19 +82,19 @@ EXAMPLES = ''' description: '{{ token_description }}' scope: "write" state: present - tower_username: "{{ my_username }}" - tower_password: "{{ my_password }}" + controller_username: "{{ my_username }}" + controller_password: "{{ my_password }}" - name: Use our new token to make another call job_list: - tower_oauthtoken: "{{ tower_token }}" + controller_oauthtoken: "{{ token }}" always: - name: Delete our Token with the token we created token: - existing_token: "{{ tower_token }}" + existing_token: "{{ token }}" state: absent - when: tower_token is defined + when: token is defined - name: Delete a token by its id token: @@ -125,7 +125,7 @@ def return_token(module, last_response): # This method will return the entire token object we got back so that a user has access to the token module.json_output['ansible_facts'] = { - 'tower_token': last_response, + 'token': last_response, } module.exit_json(**module.json_output) diff --git a/awx_collection/plugins/modules/user.py b/awx_collection/plugins/modules/user.py index befb48e732..3867f9dd73 100644 --- a/awx_collection/plugins/modules/user.py +++ b/awx_collection/plugins/modules/user.py @@ -79,7 +79,7 @@ EXAMPLES = ''' first_name: John last_name: Doe state: present - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" - name: Add user as a system administrator user: @@ -88,7 +88,7 @@ EXAMPLES = ''' email: jdoe@example.org superuser: yes state: present - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" - name: Add user as a system auditor user: @@ -97,14 +97,14 @@ EXAMPLES = ''' email: jdoe@example.org auditor: yes state: present - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" - name: Delete user user: username: jdoe email: jdoe@example.org state: absent - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" ''' from ..module_utils.controller_api import ControllerAPIModule diff --git a/awx_collection/test/awx/test_module_utils.py b/awx_collection/test/awx/test_module_utils.py index fdfc382f77..5d41d3ccb8 100644 --- a/awx_collection/test/awx/test_module_utils.py +++ b/awx_collection/test/awx/test_module_utils.py @@ -129,7 +129,7 @@ def test_type_warning(collection_import, silence_warning): def test_duplicate_config(collection_import, silence_warning): # imports done here because of PATH issues unique to this test suite ControllerAPIModule = collection_import('plugins.module_utils.controller_api').ControllerAPIModule - data = {'name': 'zigzoom', 'zig': 'zoom', 'tower_username': 'bob', 'tower_config_file': 'my_config'} + data = {'name': 'zigzoom', 'zig': 'zoom', 'controller_username': 'bob', 'controller_config_file': 'my_config'} with mock.patch.object(ControllerAPIModule, 'load_config') as mock_load: argument_spec = dict( @@ -140,8 +140,8 @@ def test_duplicate_config(collection_import, silence_warning): assert mock_load.mock_calls[-1] == mock.call('my_config') silence_warning.assert_called_once_with( - 'The parameter(s) tower_username were provided at the same time as ' - 'tower_config_file. Precedence may be unstable, ' + 'The parameter(s) controller_username were provided at the same time as ' + 'controller_config_file. Precedence may be unstable, ' 'we suggest either using config file or params.' ) @@ -167,7 +167,7 @@ def test_conflicting_name_and_id(run_module, admin_user): one item has an id that matches input one item has a name that matches input We should preference the id over the name. - Otherwise, the universality of the tower_api lookup plugin is compromised. + Otherwise, the universality of the controller_api lookup plugin is compromised. """ org_by_id = Organization.objects.create(name='foo') slug = str(org_by_id.id) diff --git a/awx_collection/test/awx/test_organization.py b/awx_collection/test/awx/test_organization.py index a3f3a724e1..08d35ed6f7 100644 --- a/awx_collection/test/awx/test_organization.py +++ b/awx_collection/test/awx/test_organization.py @@ -15,12 +15,12 @@ def test_create_organization(run_module, admin_user): 'description': 'barfoo', 'state': 'present', 'max_hosts': '0', - 'tower_host': None, - 'tower_username': None, - 'tower_password': None, + 'controller_host': None, + 'controller_username': None, + 'controller_password': None, 'validate_certs': None, - 'tower_oauthtoken': None, - 'tower_config_file': None, + 'controller_oauthtoken': None, + 'controller_config_file': None, } result = run_module('organization', module_args, admin_user) diff --git a/awx_collection/test/awx/test_token.py b/awx_collection/test/awx/test_token.py index a09cb4762e..d49dd01df9 100644 --- a/awx_collection/test/awx/test_token.py +++ b/awx_collection/test/awx/test_token.py @@ -14,12 +14,12 @@ def test_create_token(run_module, admin_user): 'description': 'barfoo', 'state': 'present', 'scope': 'read', - 'tower_host': None, - 'tower_username': None, - 'tower_password': None, + 'controller_host': None, + 'controller_username': None, + 'controller_password': None, 'validate_certs': None, - 'tower_oauthtoken': None, - 'tower_config_file': None, + 'controller_oauthtoken': None, + 'controller_config_file': None, } result = run_module('token', module_args, admin_user) diff --git a/awx_collection/tests/integration/targets/job_template/tasks/main.yml b/awx_collection/tests/integration/targets/job_template/tasks/main.yml index 9cbc5b9c2a..612e32ecc0 100644 --- a/awx_collection/tests/integration/targets/job_template/tasks/main.yml +++ b/awx_collection/tests/integration/targets/job_template/tasks/main.yml @@ -18,7 +18,7 @@ group_name1: "AWX-Collection-tests-instance_group-group1-{{ test_id }}" - name: "Create a new organization" - tower_organization: + organization: name: "{{ org_name }}" galaxy_credentials: - Ansible Galaxy @@ -53,7 +53,7 @@ kind: ssh - name: Create Labels - tower_label: + label: name: "{{ lab1 }}" organization: "{{ item }}" loop: @@ -423,7 +423,7 @@ state: absent - name: "Remove the organization" - tower_organization: + organization: name: "{{ org_name }}" state: absent register: result diff --git a/awx_collection/tests/integration/targets/token/tasks/main.yml b/awx_collection/tests/integration/targets/token/tasks/main.yml index 144c4d7175..f6f76f49cf 100644 --- a/awx_collection/tests/integration/targets/token/tasks/main.yml +++ b/awx_collection/tests/integration/targets/token/tasks/main.yml @@ -5,7 +5,7 @@ - name: Try to use a token as a dict which is missing the token parameter job_list: - tower_oauthtoken: + controller_oauthtoken: not_token: "This has no token entry" register: results ignore_errors: true @@ -13,11 +13,11 @@ - assert: that: - results is failed - - '"The provided dict in tower_oauthtoken did not properly contain the token entry" == results.msg' + - '"The provided dict in controller_oauthtoken did not properly contain the token entry" == results.msg' - name: Try to use a token as a list job_list: - tower_oauthtoken: + controller_oauthtoken: - dummy_token register: results ignore_errors: true @@ -25,7 +25,7 @@ - assert: that: - results is failed - - '"The provided tower_oauthtoken type was not valid (list). Valid options are str or dict." == results.msg' + - '"The provided controller_oauthtoken type was not valid (list). Valid options are str or dict." == results.msg' - name: Try to delete a token with no existing_token or existing_token_id token: @@ -63,21 +63,21 @@ - name: Validate our token works by token job_list: - tower_oauthtoken: "{{ tower_token.token }}" + oauthtoken: "{{ token.token }}" register: job_list - name: Validate out token works by object job_list: - tower_oauthtoken: "{{ tower_token }}" + oauthtoken: "{{ token }}" register: job_list always: - name: Delete our Token with our own token token: - existing_token: "{{ tower_token }}" - tower_oauthtoken: "{{ tower_token }}" + existing_token: "{{ token }}" + oauthtoken: "{{ token }}" state: absent - when: tower_token is defined + when: token is defined register: results - assert: @@ -99,10 +99,10 @@ always: - name: Delete the second Token with our own token token: - existing_token_id: "{{ tower_token['id'] }}" - tower_oauthtoken: "{{ tower_token }}" + existing_token_id: "{{ token['id'] }}" + oauthtoken: "{{ token }}" state: absent - when: tower_token is defined + when: token is defined register: results - assert: diff --git a/awx_collection/tests/integration/targets/user/tasks/main.yml b/awx_collection/tests/integration/targets/user/tasks/main.yml index bd5a2c4660..fee9876a3c 100644 --- a/awx_collection/tests/integration/targets/user/tasks/main.yml +++ b/awx_collection/tests/integration/targets/user/tasks/main.yml @@ -110,11 +110,11 @@ email: joe@example.org state: present validate_certs: true - tower_host: http://foo.invalid + controller_host: http://foo.invalid ignore_errors: true register: result - assert: that: - - "'Unable to resolve tower_host' in result.msg or + - "'Unable to resolve controller_host' in result.msg or 'Can not verify ssl with non-https protocol' in result.exception" diff --git a/awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml b/awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml index fd61783266..527481281b 100644 --- a/awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml +++ b/awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml @@ -19,7 +19,7 @@ project_inv_source: "AWX-Collection-tests-inventory_source-inv-source-project-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - name: "Create a new organization" - tower_organization: + organization: name: "{{ org_name }}" galaxy_credentials: - Ansible Galaxy @@ -64,7 +64,7 @@ register: result - name: Create Labels - tower_label: + label: name: "{{ lab1 }}" organization: "{{ item }}" loop: @@ -667,7 +667,7 @@ state: absent - name: "Remove the organization" - tower_organization: + organization: name: "{{ org_name }}" state: absent register: result diff --git a/awx_collection/tools/roles/template_galaxy/tasks/main.yml b/awx_collection/tools/roles/template_galaxy/tasks/main.yml index 0e3f0630a9..b53d339771 100644 --- a/awx_collection/tools/roles/template_galaxy/tasks/main.yml +++ b/awx_collection/tools/roles/template_galaxy/tasks/main.yml @@ -36,9 +36,9 @@ - name: Change runtime.yml redirect destinations replace: - path: "{{ collection_path}}/meta/runtime.yml" + path: "{{ collection_path }}/meta/runtime.yml" regexp: "redirect: awx.awx." - replace: "redirect: '{{ collection_namespace }}.{{ collection_package }}." + replace: "redirect: {{ collection_namespace }}.{{ collection_package }}." - name: get list of test files find: From 54dd24b96b187c071fec500f8c7d670d5feb05d9 Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Mon, 17 May 2021 13:12:16 -0400 Subject: [PATCH 13/31] auth_plugin env alternative --- .../plugins/doc_fragments/auth_plugin.py | 15 ++++++++++ .../plugins/lookup/controller_api.py | 3 +- awx_collection/tests/sanity/ignore-2.11.txt | 2 +- awx_collection/tests/sanity/ignore-2.9.txt | 28 +++++++++---------- 4 files changed, 32 insertions(+), 16 deletions(-) diff --git a/awx_collection/plugins/doc_fragments/auth_plugin.py b/awx_collection/plugins/doc_fragments/auth_plugin.py index 0243d2069e..644bce9c9a 100644 --- a/awx_collection/plugins/doc_fragments/auth_plugin.py +++ b/awx_collection/plugins/doc_fragments/auth_plugin.py @@ -17,19 +17,31 @@ options: description: The network address of your Automation Platform Controller host. env: - name: CONTROLLER_HOST + - name: TOWER_HOST + deprecated: + alternatives: 'CONTROLLER_HOST' username: description: The user that you plan to use to access inventories on the controller. env: - name: CONTROLLER_USERNAME + - name: TOWER_USERNAME + deprecated: + alternatives: 'CONTROLLER_USERNAME' password: description: The password for your controller user. env: - name: CONTROLLER_PASSWORD + - name: TOWER_PASSWORD + deprecated: + alternatives: 'CONTROLLER_PASSWORD' oauth_token: description: - The OAuth token to use. env: - name: CONTROLLER_OAUTH_TOKEN + - name: TOWER_OAUTH_TOKEN + deprecated: + alternatives: 'CONTROLLER_OAUTH_TOKEN' verify_ssl: description: - Specify whether Ansible should verify the SSL certificate of the controller host. @@ -37,6 +49,9 @@ options: type: bool env: - name: CONTROLLER_VERIFY_SSL + - name: TOWER_VERIFY_SSL + deprecated: + alternatives: 'CONTROLLER_VERIFY_SSL' aliases: [ validate_certs ] notes: diff --git a/awx_collection/plugins/lookup/controller_api.py b/awx_collection/plugins/lookup/controller_api.py index d959d17b8a..d1de34271d 100644 --- a/awx_collection/plugins/lookup/controller_api.py +++ b/awx_collection/plugins/lookup/controller_api.py @@ -75,7 +75,8 @@ EXAMPLES = """ - name: Load the UI settings specifying the connection info set_fact: - controller_settings: "{{ lookup('awx.awx.controller_api', 'settings/ui' host='controller.example.com', username='admin', password=my_pass_var, verify_ssl=False) }}" + controller_settings: "{{ lookup('awx.awx.controller_api', 'settings/ui' host='controller.example.com', + username='admin', password=my_pass_var, verify_ssl=False) }}" - name: Report the usernames of all users with admin privs debug: diff --git a/awx_collection/tests/sanity/ignore-2.11.txt b/awx_collection/tests/sanity/ignore-2.11.txt index 88c3a3f195..6964b9b84c 100644 --- a/awx_collection/tests/sanity/ignore-2.11.txt +++ b/awx_collection/tests/sanity/ignore-2.11.txt @@ -1 +1 @@ -plugins/module_utils/tower_api.py pep8:E203 +plugins/module_utils/controller_api.py pep8:E203 diff --git a/awx_collection/tests/sanity/ignore-2.9.txt b/awx_collection/tests/sanity/ignore-2.9.txt index 8394f83e57..5eb23a7b61 100644 --- a/awx_collection/tests/sanity/ignore-2.9.txt +++ b/awx_collection/tests/sanity/ignore-2.9.txt @@ -1,16 +1,16 @@ -plugins/modules/tower_receive.py validate-modules:deprecation-mismatch -plugins/modules/tower_receive.py validate-modules:invalid-documentation -plugins/modules/tower_send.py validate-modules:deprecation-mismatch -plugins/modules/tower_send.py validate-modules:invalid-documentation -plugins/modules/tower_workflow_template.py validate-modules:deprecation-mismatch -plugins/modules/tower_workflow_template.py validate-modules:invalid-documentation -plugins/inventory/tower.py pylint:raise-missing-from -plugins/inventory/tower.py pylint:super-with-arguments -plugins/lookup/tower_schedule_rrule.py pylint:raise-missing-from -plugins/module_utils/tower_api.py pylint:super-with-arguments -plugins/module_utils/tower_awxkit.py pylint:super-with-arguments +plugins/modules/receive.py validate-modules:deprecation-mismatch +plugins/modules/receive.py validate-modules:invalid-documentation +plugins/modules/send.py validate-modules:deprecation-mismatch +plugins/modules/send.py validate-modules:invalid-documentation +plugins/modules/workflow_template.py validate-modules:deprecation-mismatch +plugins/modules/workflow_template.py validate-modules:invalid-documentation +plugins/inventory/controller.py pylint:raise-missing-from +plugins/inventory/controller.py pylint:super-with-arguments +plugins/lookup/schedule_rrule.py pylint:raise-missing-from +plugins/module_utils/controller_api.py pylint:super-with-arguments +plugins/module_utils/awxkit.py pylint:super-with-arguments plugins/module_utils/tower_legacy.py pylint:super-with-arguments -plugins/module_utils/tower_module.py pylint:super-with-arguments -plugins/module_utils/tower_module.py pylint:raise-missing-from +plugins/module_utils/controller_module.py pylint:super-with-arguments +plugins/module_utils/controller_module.py pylint:raise-missing-from test/awx/conftest.py pylint:raise-missing-from -plugins/module_utils/tower_api.py pep8:E203 +plugins/module_utils/controller_api.py pep8:E203 From 4add72b9d27116ddd0b5f478634a956e588ba8aa Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Tue, 18 May 2021 10:43:53 -0400 Subject: [PATCH 14/31] actually make use of option aliases --- awx_collection/meta/runtime.yml | 120 +++++++++--------- .../plugins/module_utils/controller_module.py | 10 +- awx_collection/plugins/modules/token.py | 4 +- .../integration/targets/token/tasks/main.yml | 18 +-- 4 files changed, 78 insertions(+), 74 deletions(-) diff --git a/awx_collection/meta/runtime.yml b/awx_collection/meta/runtime.yml index b8a868a73e..37cecb9bc5 100644 --- a/awx_collection/meta/runtime.yml +++ b/awx_collection/meta/runtime.yml @@ -38,94 +38,98 @@ plugin_routing: tower_schedule_rrule: redirect: awx.awx.schedule_rrule modules: - tower_job_list: - redirect: awx.awx.job_list - tower_job_launch: - redirect: awx.awx.job_launch - tower_workflow_job_template: - redirect: awx.awx.workflow_job_template - tower_team: - redirect: awx.awx.team - tower_job_wait: - redirect: awx.awx.job_wait - tower_application: - redirect: awx.awx.application + tower_ad_hoc_command_cancel: + redirect: awx.awx.ad_hoc_command_cancel tower_ad_hoc_command_wait: redirect: awx.awx.ad_hoc_command_wait + tower_ad_hoc_command: + redirect: awx.awx.ad_hoc_command + tower_application: + redirect: awx.awx.application + tower_meta: + redirect: awx.awx.controller_meta + tower_credential_input_source: + redirect: awx.awx.credential_input_source + tower_credential_type: + redirect: awx.awx.credential_type tower_credential: redirect: awx.awx.credential - tower_label: - redirect: awx.awx.label + tower_execution_environment: + redirect: awx.awx.execution_environment + tower_export: + redirect: awx.awx.export tower_group: redirect: awx.awx.group tower_host: redirect: awx.awx.host - tower_schedule: - redirect: awx.awx.schedule - tower_role: - redirect: awx.awx.role - tower_ad_hoc_command: - redirect: awx.awx.ad_hoc_command - tower_execution_environment: - redirect: awx.awx.execution_environment - tower_inventory_source_update: - redirect: awx.awx.inventory_source_update + tower_import: + redirect: awx.awx.import tower_instance_group: redirect: awx.awx.instance_group - tower_settings: - redirect: awx.awx.settings - tower_meta: - redirect: awx.awx.controller_meta - tower_export: - redirect: awx.awx.export - tower_ad_hoc_command_cancel: - redirect: awx.awx.ad_hoc_command_cancel + tower_inventory_source_update: + redirect: awx.awx.inventory_source_update tower_inventory_source: redirect: awx.awx.inventory_source - tower_user: - redirect: awx.awx.user - tower_workflow_launch: - redirect: awx.awx.workflow_launch - tower_project: - redirect: awx.awx.project - tower_token: - redirect: awx.awx.token - tower_credential_type: - redirect: awx.awx.credential_type + tower_inventory: + redirect: awx.awx.inventory + tower_job_cancel: + redirect: awx.awx.job_cancel + tower_job_launch: + redirect: awx.awx.job_launch + tower_job_list: + redirect: awx.awx.job_list + tower_job_template: + redirect: awx.awx.job_template + tower_job_wait: + redirect: awx.awx.job_wait + tower_label: + redirect: awx.awx.label tower_license: redirect: awx.awx.license - tower_project_update: - redirect: awx.awx.project_update tower_notification_template: redirect: awx.awx.notification_template + tower_notification: + redirect: awx.awx.notification_template tower_organization: redirect: awx.awx.organization - tower_job_template: - redirect: awx.awx.job_template - tower_workflow_job_template_node: - redirect: awx.awx.workflow_job_template_node - tower_job_cancel: - redirect: awx.awx.job_cancel - tower_import: - redirect: awx.awx.import - tower_credential_input_source: - redirect: awx.awx.credential_input_source - tower_inventory: - redirect: awx.awx.inventory + tower_project_update: + redirect: awx.awx.project_update + tower_project: + redirect: awx.awx.project tower_receive: redirect: awx.awx.receive deprecation: removal_date: TBD warning_text: see plugin documentation for details + tower_role: + redirect: awx.awx.role + tower_schedule: + redirect: awx.awx.schedule tower_send: redirect: awx.awx.send deprecation: removal_date: TBD warning_text: see plugin documentation for details + tower_settings: + redirect: awx.awx.settings + tower_team: + redirect: awx.awx.team + tower_token: + redirect: awx.awx.token + tower_user: + redirect: awx.awx.user + tower_workflow_approval: + redirect: awx.awx.workflow_approval + tower_workflow_job_template_node: + redirect: awx.awx.workflow_job_template_node + tower_workflow_job_template: + redirect: awx.awx.workflow_job_template + tower_workflow_launch: + redirect: awx.awx.workflow_launch + tower_workflow_node_wait: + redirect: awx.awx.workflow_node_wait tower_workflow_template: redirect: awx.awx.workflow_template deprecation: removal_date: TBD warning_text: see plugin documentation for details - tower_notification: - redirect: awx.awx.notification_template diff --git a/awx_collection/plugins/module_utils/controller_module.py b/awx_collection/plugins/module_utils/controller_module.py index 032c3c5b27..4e3a118309 100644 --- a/awx_collection/plugins/module_utils/controller_module.py +++ b/awx_collection/plugins/module_utils/controller_module.py @@ -32,12 +32,12 @@ class ItemNotDefined(Exception): class ControllerModule(AnsibleModule): url = None AUTH_ARGSPEC = dict( - controller_host=dict(required=False, fallback=(env_fallback, ['CONTROLLER_HOST', 'TOWER_HOST'])), - controller_username=dict(required=False, fallback=(env_fallback, ['CONTROLLER_USERNAME', 'TOWER_USERNAME'])), - controller_password=dict(no_log=True, required=False, fallback=(env_fallback, ['CONTROLLER_PASSWORD', 'TOWER_PASSWORD'])), + controller_host=dict(required=False, aliases=['tower_host'], fallback=(env_fallback, ['CONTROLLER_HOST', 'TOWER_HOST'])), + controller_username=dict(required=False, aliases=['tower_username'], fallback=(env_fallback, ['CONTROLLER_USERNAME', 'TOWER_USERNAME'])), + controller_password=dict(no_log=True, aliases=['tower_password'], required=False, fallback=(env_fallback, ['CONTROLLER_PASSWORD', 'TOWER_PASSWORD'])), validate_certs=dict(type='bool', aliases=['tower_verify_ssl'], required=False, fallback=(env_fallback, ['CONTROLLER_VERIFY_SSL', 'TOWER_VERIFY_SSL'])), - controller_oauthtoken=dict(type='raw', no_log=True, required=False, fallback=(env_fallback, ['CONTROLLER_OAUTH_TOKEN', 'TOWER_OAUTH_TOKEN'])), - controller_config_file=dict(type='path', required=False, default=None), + controller_oauthtoken=dict(type='raw', no_log=True, aliases=['tower_oauthtoken'], required=False, fallback=(env_fallback, ['CONTROLLER_OAUTH_TOKEN', 'TOWER_OAUTH_TOKEN'])), + controller_config_file=dict(type='path', aliases=['tower_config_file'], required=False, default=None), ) short_params = { 'host': 'controller_host', diff --git a/awx_collection/plugins/modules/token.py b/awx_collection/plugins/modules/token.py index 26da2d3f5f..8f695f431c 100644 --- a/awx_collection/plugins/modules/token.py +++ b/awx_collection/plugins/modules/token.py @@ -103,7 +103,7 @@ EXAMPLES = ''' ''' RETURN = ''' -token: +tower_token: type: dict description: An Ansible Fact variable representing a token object which can be used for auth in subsequent modules. See examples for usage. contains: @@ -125,7 +125,7 @@ def return_token(module, last_response): # This method will return the entire token object we got back so that a user has access to the token module.json_output['ansible_facts'] = { - 'token': last_response, + 'tower_token': last_response, } module.exit_json(**module.json_output) diff --git a/awx_collection/tests/integration/targets/token/tasks/main.yml b/awx_collection/tests/integration/targets/token/tasks/main.yml index f6f76f49cf..6769e7f232 100644 --- a/awx_collection/tests/integration/targets/token/tasks/main.yml +++ b/awx_collection/tests/integration/targets/token/tasks/main.yml @@ -63,21 +63,21 @@ - name: Validate our token works by token job_list: - oauthtoken: "{{ token.token }}" + oauthtoken: "{{ tower_token.token }}" register: job_list - - name: Validate out token works by object + - name: Validate our token works by object job_list: - oauthtoken: "{{ token }}" + oauthtoken: "{{ tower_token }}" register: job_list always: - name: Delete our Token with our own token token: - existing_token: "{{ token }}" - oauthtoken: "{{ token }}" + existing_token: "{{ tower_token }}" + oauthtoken: "{{ tower_token }}" state: absent - when: token is defined + when: tower_token is defined register: results - assert: @@ -99,10 +99,10 @@ always: - name: Delete the second Token with our own token token: - existing_token_id: "{{ token['id'] }}" - oauthtoken: "{{ token }}" + existing_token_id: "{{ tower_token['id'] }}" + oauthtoken: "{{ tower_token }}" state: absent - when: token is defined + when: tower_token is defined register: results - assert: From ee8c1638c560d487ee9e7498258dd380a4c62adc Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Tue, 18 May 2021 13:46:31 -0400 Subject: [PATCH 15/31] remove deprecated modules --- awx_collection/meta/runtime.yml | 15 -- awx_collection/plugins/modules/receive.py | 192 --------------- awx_collection/plugins/modules/send.py | 174 -------------- .../plugins/modules/workflow_template.py | 221 ------------------ awx_collection/test/awx/test_send_receive.py | 57 ----- .../test/awx/test_workflow_template.py | 102 -------- 6 files changed, 761 deletions(-) delete mode 100644 awx_collection/plugins/modules/receive.py delete mode 100644 awx_collection/plugins/modules/send.py delete mode 100644 awx_collection/plugins/modules/workflow_template.py delete mode 100644 awx_collection/test/awx/test_send_receive.py delete mode 100644 awx_collection/test/awx/test_workflow_template.py diff --git a/awx_collection/meta/runtime.yml b/awx_collection/meta/runtime.yml index 37cecb9bc5..2fad1211f5 100644 --- a/awx_collection/meta/runtime.yml +++ b/awx_collection/meta/runtime.yml @@ -96,20 +96,10 @@ plugin_routing: redirect: awx.awx.project_update tower_project: redirect: awx.awx.project - tower_receive: - redirect: awx.awx.receive - deprecation: - removal_date: TBD - warning_text: see plugin documentation for details tower_role: redirect: awx.awx.role tower_schedule: redirect: awx.awx.schedule - tower_send: - redirect: awx.awx.send - deprecation: - removal_date: TBD - warning_text: see plugin documentation for details tower_settings: redirect: awx.awx.settings tower_team: @@ -128,8 +118,3 @@ plugin_routing: redirect: awx.awx.workflow_launch tower_workflow_node_wait: redirect: awx.awx.workflow_node_wait - tower_workflow_template: - redirect: awx.awx.workflow_template - deprecation: - removal_date: TBD - warning_text: see plugin documentation for details diff --git a/awx_collection/plugins/modules/receive.py b/awx_collection/plugins/modules/receive.py deleted file mode 100644 index 4463355525..0000000000 --- a/awx_collection/plugins/modules/receive.py +++ /dev/null @@ -1,192 +0,0 @@ -#!/usr/bin/python -# coding: utf-8 -*- - -# (c) 2017, John Westcott IV -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function - -__metaclass__ = type - - -ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['deprecated'], 'supported_by': 'community'} - - -DOCUMENTATION = ''' ---- -module: receive -deprecated: - removed_in: "14.0.0" - why: Deprecated in favor of upcoming C(_export) module. - alternative: Once published, use M(tower_export) instead. -author: "John Westcott IV (@john-westcott-iv)" -short_description: Receive assets from Automation Platform Controller. -description: - - Receive assets from Automation Platform Controller. See - U(https://www.ansible.com/tower) for an overview. -options: - all: - description: - - Export all assets - type: bool - default: 'False' - organization: - description: - - List of organization names to export - default: [] - type: list - elements: str - user: - description: - - List of user names to export - default: [] - type: list - elements: str - team: - description: - - List of team names to export - default: [] - type: list - elements: str - credential_type: - description: - - List of credential type names to export - default: [] - type: list - elements: str - credential: - description: - - List of credential names to export - default: [] - type: list - elements: str - notification_template: - description: - - List of notification template names to export - default: [] - type: list - elements: str - inventory: - description: - - List of inventory names to export - default: [] - type: list - elements: str - project: - description: - - List of project names to export - default: [] - type: list - elements: str - job_template: - description: - - List of job template names to export - default: [] - type: list - elements: str - workflow: - description: - - List of workflow names to export - default: [] - type: list - elements: str - -requirements: - - "ansible-tower-cli >= 3.3.0" - -notes: - - Specifying a name of "all" for any asset type will export all items of that asset type. - -extends_documentation_fragment: awx.awx.auth_legacy -''' - -EXAMPLES = ''' -- name: Export all Automation Platform Controller assets - receive: - all: True - controller_config_file: "~/tower_cli.cfg" - -- name: Export all inventories - receive: - inventory: - - all - -- name: Export a job template named "My Template" and all Credentials - receive: - job_template: - - "My Template" - credential: - - all -''' - -RETURN = ''' -assets: - description: The exported assets - returned: success - type: dict - sample: [ {}, {} ] -''' - -from ..module_utils.tower_legacy import TowerLegacyModule, tower_auth_config, HAS_TOWER_CLI - -try: - from tower_cli.cli.transfer.receive import Receiver - from tower_cli.cli.transfer.common import SEND_ORDER - from tower_cli.utils.exceptions import TowerCLIError - - from tower_cli.conf import settings - - TOWER_CLI_HAS_EXPORT = True -except ImportError: - TOWER_CLI_HAS_EXPORT = False - - -def main(): - argument_spec = dict( - all=dict(type='bool', default=False), - credential=dict(type='list', default=[], elements='str'), - credential_type=dict(type='list', default=[], elements='str'), - inventory=dict(type='list', default=[], elements='str'), - job_template=dict(type='list', default=[], elements='str'), - notification_template=dict(type='list', default=[], elements='str'), - organization=dict(type='list', default=[], elements='str'), - project=dict(type='list', default=[], elements='str'), - team=dict(type='list', default=[], elements='str'), - user=dict(type='list', default=[], elements='str'), - workflow=dict(type='list', default=[], elements='str'), - ) - - module = TowerLegacyModule(argument_spec=argument_spec, supports_check_mode=False) - - module.deprecate(msg="This module is deprecated and will be replaced by the AWX CLI export command.", version="awx.awx:14.0.0") - - if not HAS_TOWER_CLI: - module.fail_json(msg='ansible-tower-cli required for this module') - - if not TOWER_CLI_HAS_EXPORT: - module.fail_json(msg='ansible-tower-cli version does not support export') - - export_all = module.params.get('all') - assets_to_export = {} - for asset_type in SEND_ORDER: - assets_to_export[asset_type] = module.params.get(asset_type) - - result = dict( - assets=None, - changed=False, - message='', - ) - - tower_auth = tower_auth_config(module) - with settings.runtime_values(**tower_auth): - try: - receiver = Receiver() - result['assets'] = receiver.export_assets(all=export_all, asset_input=assets_to_export) - module.exit_json(**result) - except TowerCLIError as e: - result['message'] = e.message - module.fail_json(msg='Receive Failed', **result) - - -if __name__ == '__main__': - main() diff --git a/awx_collection/plugins/modules/send.py b/awx_collection/plugins/modules/send.py deleted file mode 100644 index 7bff90ea64..0000000000 --- a/awx_collection/plugins/modules/send.py +++ /dev/null @@ -1,174 +0,0 @@ -#!/usr/bin/python -# coding: utf-8 -*- - -# (c) 2017, John Westcott IV -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function - -__metaclass__ = type - - -ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['deprecated'], 'supported_by': 'community'} - - -DOCUMENTATION = ''' ---- -module: send -deprecated: - removed_in: "14.0.0" - why: Deprecated in favor of upcoming C(_import) module. - alternative: Once published, use M(tower_import) instead. -author: "John Westcott IV (@john-westcott-iv)" -short_description: Send assets to Automation Platform Controller. -description: - - Send assets to Automation Platform Controller. See - U(https://www.ansible.com/tower) for an overview. -options: - assets: - description: - - The assets to import. - - This can be the output of tower_receive or loaded from a file - type: str - files: - description: - - List of files to import. - default: [] - type: list - elements: str - prevent: - description: - - A list of asset types to prevent import for - default: [] - type: list - elements: str - password_management: - description: - - The password management option to use. - - The prompt option is not supported. - default: 'default' - choices: ["default", "random"] - type: str - -notes: - - One of assets or files needs to be passed in - -requirements: - - "ansible-tower-cli >= 3.3.0" - - six.moves.StringIO - - sys - -extends_documentation_fragment: awx.awx.auth_legacy -''' - -EXAMPLES = ''' -- name: Import all Automation Platform Controller assets - send: - assets: "{{ export_output.assets }}" - controller_config_file: "~/tower_cli.cfg" -''' - -RETURN = ''' -output: - description: The import messages - returned: success, fail - type: list - sample: [ 'Message 1', 'Message 2' ] -''' - -import os -import sys - -from ansible.module_utils.six.moves import StringIO -from ..module_utils.tower_legacy import TowerLegacyModule, tower_auth_config, HAS_TOWER_CLI - -from tempfile import mkstemp - -try: - from tower_cli.cli.transfer.send import Sender - from tower_cli.utils.exceptions import TowerCLIError - - from tower_cli.conf import settings - - TOWER_CLI_HAS_EXPORT = True -except ImportError: - TOWER_CLI_HAS_EXPORT = False - - -def main(): - argument_spec = dict( - assets=dict(), - files=dict(default=[], type='list', elements='str'), - prevent=dict(default=[], type='list', elements='str'), - password_management=dict(default='default', choices=['default', 'random']), - ) - - module = TowerLegacyModule(argument_spec=argument_spec, supports_check_mode=False) - - module.deprecate(msg="This module is deprecated and will be replaced by the AWX CLI import command", version="awx.awx:14.0.0") - - if not HAS_TOWER_CLI: - module.fail_json(msg='ansible-tower-cli required for this module') - - if not TOWER_CLI_HAS_EXPORT: - module.fail_json(msg='ansible-tower-cli version does not support export') - - assets = module.params.get('assets') - prevent = module.params.get('prevent') - password_management = module.params.get('password_management') - files = module.params.get('files') - - result = dict( - changed=False, - msg='', - output='', - ) - - if not assets and not files: - result['msg'] = "Assets or files must be specified" - module.fail_json(**result) - - path = None - if assets: - # We got assets so we need to dump this out to a temp file and append that to files - handle, path = mkstemp(prefix='', suffix='', dir='') - with open(path, 'w') as f: - f.write(assets) - files.append(path) - - tower_auth = tower_auth_config(module) - failed = False - with settings.runtime_values(**tower_auth): - try: - sender = Sender(no_color=False) - old_stdout = sys.stdout - sys.stdout = captured_stdout = StringIO() - try: - sender.send(files, prevent, password_management) - except TypeError: - # Newer versions of TowerCLI require 4 parameters - sender.send(files, prevent, [], password_management) - - if sender.error_messages > 0: - failed = True - result['msg'] = "Transfer Failed with %d errors" % sender.error_messages - if sender.changed_messages > 0: - result['changed'] = True - except TowerCLIError as e: - result['msg'] = e.message - failed = True - finally: - if path is not None: - os.remove(path) - result['output'] = captured_stdout.getvalue().split("\n") - sys.stdout = old_stdout - - # Return stdout so that module returns will work - if failed: - module.fail_json(**result) - else: - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/awx_collection/plugins/modules/workflow_template.py b/awx_collection/plugins/modules/workflow_template.py deleted file mode 100644 index f100ee46f2..0000000000 --- a/awx_collection/plugins/modules/workflow_template.py +++ /dev/null @@ -1,221 +0,0 @@ -#!/usr/bin/python -# coding: utf-8 -*- - -# Copyright: (c) 2018, Adrien Fleury -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function - -__metaclass__ = type - - -ANSIBLE_METADATA = {'status': ['deprecated'], 'supported_by': 'community', 'metadata_version': '1.1'} - - -DOCUMENTATION = ''' ---- -module: workflow_template -deprecated: - removed_in: "14.0.0" - why: Deprecated in favor of C(_workflow_job_template) and C(_workflow_job_template_node) modules. - alternative: Use M(tower_workflow_job_template) and M(_workflow_job_template_node) instead. -author: "Adrien Fleury (@fleu42)" -short_description: create, update, or destroy Automation Platform Controller workflow template. -description: - - A tower-cli based module for CRUD actions on workflow job templates. - - Enables use of the old schema functionality. - - Not updated for new features, convert to the modules for - workflow_job_template and workflow_job_template node instead. -options: - allow_simultaneous: - description: - - If enabled, simultaneous runs of this job template will be allowed. - type: bool - ask_extra_vars: - description: - - Prompt user for (extra_vars) on launch. - type: bool - ask_inventory: - description: - - Prompt user for inventory on launch. - type: bool - description: - description: - - The description to use for the workflow. - type: str - extra_vars: - description: - - Extra variables used by Ansible in YAML or key=value format. - type: dict - inventory: - description: - - Name of the inventory to use for the job template. - type: str - name: - description: - - The name to use for the workflow. - required: True - type: str - organization: - description: - - The organization the workflow is linked to. - type: str - schema: - description: - - > - The schema is a JSON- or YAML-formatted string defining the - hierarchy structure that connects the nodes. Refer to the Automation Platform - documentation for more information. - type: list - elements: dict - survey_enabled: - description: - - Setting that variable will prompt the user for job type on the - workflow launch. - type: bool - survey: - description: - - The definition of the survey associated to the workflow. - type: dict - state: - description: - - Desired state of the resource. - default: "present" - choices: ["present", "absent"] - type: str - -requirements: -- ansible-tower-cli >= 3.0.2 - -extends_documentation_fragment: awx.awx.auth_legacy -''' - - -EXAMPLES = ''' -- workflow_template: - name: Workflow Template - description: My very first Workflow Template - organization: My optional Organization - schema: "{{ lookup('file', 'my_workflow.json') }}" - -- workflow_template: - name: Workflow Template - state: absent -''' - - -RETURN = ''' # ''' - - -from ..module_utils.tower_legacy import TowerLegacyModule, tower_auth_config, tower_check_mode - -import json - -try: - import tower_cli - import tower_cli.exceptions as exc - from tower_cli.conf import settings -except ImportError: - pass - - -def main(): - argument_spec = dict( - name=dict(required=True), - description=dict(), - extra_vars=dict(type='dict'), - organization=dict(), - allow_simultaneous=dict(type='bool'), - schema=dict(type='list', elements='dict'), - survey=dict(type='dict'), - survey_enabled=dict(type='bool'), - inventory=dict(), - ask_inventory=dict(type='bool'), - ask_extra_vars=dict(type='bool'), - state=dict(choices=['present', 'absent'], default='present'), - ) - - module = TowerLegacyModule(argument_spec=argument_spec, supports_check_mode=False) - - module.deprecate( - msg=( - "This module is replaced by the combination of tower_workflow_job_template and " - "tower_workflow_job_template_node. This uses the old tower-cli and wll be " - "removed in 2022." - ), - version='awx.awx:14.0.0', - ) - - name = module.params.get('name') - state = module.params.get('state') - - schema = None - if module.params.get('schema'): - schema = module.params.get('schema') - - if schema and state == 'absent': - module.fail_json(msg='Setting schema when state is absent is not allowed', changed=False) - - json_output = {'workflow_template': name, 'state': state} - - tower_auth = tower_auth_config(module) - with settings.runtime_values(**tower_auth): - tower_check_mode(module) - wfjt_res = tower_cli.get_resource('workflow') - params = {} - params['name'] = name - - if module.params.get('description'): - params['description'] = module.params.get('description') - - if module.params.get('organization'): - organization_res = tower_cli.get_resource('organization') - try: - organization = organization_res.get(name=module.params.get('organization')) - params['organization'] = organization['id'] - except exc.NotFound as excinfo: - module.fail_json(msg='Failed to update organization source,' 'organization not found: {0}'.format(excinfo), changed=False) - - if module.params.get('survey'): - params['survey_spec'] = module.params.get('survey') - - if module.params.get('ask_extra_vars'): - params['ask_variables_on_launch'] = module.params.get('ask_extra_vars') - - if module.params.get('ask_inventory'): - params['ask_inventory_on_launch'] = module.params.get('ask_inventory') - - for key in ('allow_simultaneous', 'inventory', 'survey_enabled', 'description'): - if module.params.get(key): - params[key] = module.params.get(key) - - # Special treatment for tower-cli extra_vars - extra_vars = module.params.get('extra_vars') - if extra_vars: - params['extra_vars'] = [json.dumps(extra_vars)] - - try: - if state == 'present': - params['create_on_missing'] = True - result = wfjt_res.modify(**params) - json_output['id'] = result['id'] - if schema: - wfjt_res.schema(result['id'], json.dumps(schema)) - elif state == 'absent': - params['fail_on_missing'] = False - result = wfjt_res.delete(**params) - except (exc.ConnectionError, exc.BadRequest, exc.AuthError) as excinfo: - module.fail_json( - msg='Failed to update workflow template: \ - {0}'.format( - excinfo - ), - changed=False, - ) - - json_output['changed'] = result['changed'] - module.exit_json(**json_output) - - -if __name__ == '__main__': - main() diff --git a/awx_collection/test/awx/test_send_receive.py b/awx_collection/test/awx/test_send_receive.py deleted file mode 100644 index 47f79e2733..0000000000 --- a/awx_collection/test/awx/test_send_receive.py +++ /dev/null @@ -1,57 +0,0 @@ -from __future__ import absolute_import, division, print_function - -__metaclass__ = type - -import pytest -import json - -from awx.main.models import Organization, Project, Inventory, Host, CredentialType, Credential, JobTemplate - - -# warns based on password_management param, but not security issue -@pytest.mark.django_db -def test_receive_send_jt(run_module, admin_user, mocker, silence_deprecation): - org = Organization.objects.create(name='SRtest') - proj = Project.objects.create( - name='SRtest', - playbook_files=['debug.yml'], - scm_type='git', - scm_url='https://github.com/ansible/test-playbooks.git', - organization=org, - allow_override=True, # so we do not require playbooks populated - ) - inv = Inventory.objects.create(name='SRtest', organization=org) - Host.objects.create(name='SRtest', inventory=inv) - ct = CredentialType.defaults['ssh']() - ct.save() - cred = Credential.objects.create(name='SRtest', credential_type=ct, organization=org) - jt = JobTemplate.objects.create(name='SRtest', project=proj, inventory=inv, playbook='helloworld.yml') - jt.credentials.add(cred) - jt.admin_role.members.add(admin_user) # work around send/receive bug - - # receive everything - result = run_module('receive', dict(all=True), admin_user) - - assert 'assets' in result, result - assets = result['assets'] - assert not result.get('changed', True) - assert set(a['asset_type'] for a in assets) == set(('organization', 'inventory', 'job_template', 'credential', 'project', 'user')) - - # delete everything - for obj in (jt, inv, proj, cred, org): - obj.delete() - - def fake_wait(self, pk, parent_pk=None, **kwargs): - return {"changed": True} - - # recreate everything - with mocker.patch('sys.stdin.isatty', return_value=True): - with mocker.patch('tower_cli.models.base.MonitorableResource.wait'): - result = run_module('send', dict(assets=json.dumps(assets)), admin_user) - - assert not result.get('failed'), result - - new = JobTemplate.objects.get(name='SRtest') - assert new.project.name == 'SRtest' - assert new.inventory.name == 'SRtest' - assert [cred.name for cred in new.credentials.all()] == ['SRtest'] diff --git a/awx_collection/test/awx/test_workflow_template.py b/awx_collection/test/awx/test_workflow_template.py deleted file mode 100644 index 0776cc420b..0000000000 --- a/awx_collection/test/awx/test_workflow_template.py +++ /dev/null @@ -1,102 +0,0 @@ -from __future__ import absolute_import, division, print_function - -__metaclass__ = type - -import pytest - -from awx.main.models import WorkflowJobTemplate, JobTemplate, Project, InventorySource, Inventory, WorkflowJobTemplateNode - - -@pytest.mark.django_db -def test_create_workflow_job_template(run_module, admin_user, organization, survey_spec, silence_deprecation): - result = run_module( - 'workflow_template', - { - 'name': 'foo-workflow', - 'organization': organization.name, - 'extra_vars': {'foo': 'bar', 'another-foo': {'barz': 'bar2'}}, - 'survey': survey_spec, - 'survey_enabled': True, - 'state': 'present', - }, - admin_user, - ) - - wfjt = WorkflowJobTemplate.objects.get(name='foo-workflow') - assert wfjt.extra_vars == '{"foo": "bar", "another-foo": {"barz": "bar2"}}' - - result.pop('invocation', None) - assert result == {"workflow_template": "foo-workflow", "state": "present", "id": wfjt.id, "changed": True} # TODO: remove after refactor - - assert wfjt.organization_id == organization.id - assert wfjt.survey_spec == survey_spec - - -@pytest.mark.django_db -def test_with_nested_workflow(run_module, admin_user, organization, silence_deprecation): - wfjt1 = WorkflowJobTemplate.objects.create(name='first', organization=organization) - - result = run_module( - 'workflow_template', - {'name': 'foo-workflow', 'organization': organization.name, 'schema': [{'workflow': wfjt1.name}], 'state': 'present'}, - admin_user, - ) - assert not result.get('failed', False), result.get('msg', result) - - wfjt = WorkflowJobTemplate.objects.get(name='foo-workflow') - node = wfjt.workflow_nodes.first() - assert node is not None - assert node.unified_job_template == wfjt1 - - -@pytest.mark.django_db -def test_schema_with_branches(run_module, admin_user, organization, silence_deprecation): - - proj = Project.objects.create(organization=organization, name='Ansible Examples') - inv = Inventory.objects.create(organization=organization, name='test-inv') - jt = JobTemplate.objects.create(project=proj, playbook='helloworld.yml', inventory=inv, name='Hello world') - inv_src = InventorySource.objects.create(inventory=inv, name='AWS servers', source='ec2') - - result = run_module( - 'workflow_template', - { - 'name': 'foo-workflow', - 'organization': organization.name, - 'schema': [ - { - 'job_template': 'Hello world', - 'failure': [{'inventory_source': 'AWS servers', 'success': [{'project': 'Ansible Examples', 'always': [{'job_template': "Hello world"}]}]}], - } - ], - 'state': 'present', - }, - admin_user, - ) - assert not result.get('failed', False), result.get('msg', result) - - wfjt = WorkflowJobTemplate.objects.get(name='foo-workflow') - root_nodes = wfjt.workflow_nodes.filter( - **{ - '%ss_success__isnull' % WorkflowJobTemplateNode.__name__.lower(): True, - '%ss_failure__isnull' % WorkflowJobTemplateNode.__name__.lower(): True, - '%ss_always__isnull' % WorkflowJobTemplateNode.__name__.lower(): True, - } - ) - assert len(root_nodes) == 1 - node = root_nodes[0] - assert node.unified_job_template == jt - second = node.failure_nodes.first() - assert second.unified_job_template == inv_src - third = second.success_nodes.first() - assert third.unified_job_template == proj - fourth = third.always_nodes.first() - assert fourth.unified_job_template == jt - - -@pytest.mark.django_db -def test_with_missing_ujt(run_module, admin_user, organization, silence_deprecation): - result = run_module( - 'workflow_template', {'name': 'foo-workflow', 'organization': organization.name, 'schema': [{'foo': 'bar'}], 'state': 'present'}, admin_user - ) - assert result.get('failed', False), result - assert 'You should provide exactly one of the attributes job_template,' in result['msg'] From 8fd92256299af6776fb1640e895100b07fa7d7a1 Mon Sep 17 00:00:00 2001 From: Sarabraj Singh Date: Fri, 21 May 2021 10:50:04 -0400 Subject: [PATCH 16/31] removed un-reference-able python modules from ignore-2.9.txt --- awx_collection/tests/sanity/ignore-2.9.txt | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/awx_collection/tests/sanity/ignore-2.9.txt b/awx_collection/tests/sanity/ignore-2.9.txt index 5eb23a7b61..f5e44180b6 100644 --- a/awx_collection/tests/sanity/ignore-2.9.txt +++ b/awx_collection/tests/sanity/ignore-2.9.txt @@ -1,9 +1,3 @@ -plugins/modules/receive.py validate-modules:deprecation-mismatch -plugins/modules/receive.py validate-modules:invalid-documentation -plugins/modules/send.py validate-modules:deprecation-mismatch -plugins/modules/send.py validate-modules:invalid-documentation -plugins/modules/workflow_template.py validate-modules:deprecation-mismatch -plugins/modules/workflow_template.py validate-modules:invalid-documentation plugins/inventory/controller.py pylint:raise-missing-from plugins/inventory/controller.py pylint:super-with-arguments plugins/lookup/schedule_rrule.py pylint:raise-missing-from @@ -13,4 +7,4 @@ plugins/module_utils/tower_legacy.py pylint:super-with-arguments plugins/module_utils/controller_module.py pylint:super-with-arguments plugins/module_utils/controller_module.py pylint:raise-missing-from test/awx/conftest.py pylint:raise-missing-from -plugins/module_utils/controller_api.py pep8:E203 +plugins/module_utils/controller_api.py pep8:E203 \ No newline at end of file From 378a0711c2ce32e4a49499b7e8cd03819d3c15bc Mon Sep 17 00:00:00 2001 From: Sarabraj Singh Date: Fri, 21 May 2021 10:54:29 -0400 Subject: [PATCH 17/31] linted AUTH_ARGSPEC to make it easier to read (<180 characters in the same line) --- .../plugins/module_utils/controller_module.py | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/awx_collection/plugins/module_utils/controller_module.py b/awx_collection/plugins/module_utils/controller_module.py index 4e3a118309..0fbae9ff50 100644 --- a/awx_collection/plugins/module_utils/controller_module.py +++ b/awx_collection/plugins/module_utils/controller_module.py @@ -32,12 +32,35 @@ class ItemNotDefined(Exception): class ControllerModule(AnsibleModule): url = None AUTH_ARGSPEC = dict( - controller_host=dict(required=False, aliases=['tower_host'], fallback=(env_fallback, ['CONTROLLER_HOST', 'TOWER_HOST'])), - controller_username=dict(required=False, aliases=['tower_username'], fallback=(env_fallback, ['CONTROLLER_USERNAME', 'TOWER_USERNAME'])), - controller_password=dict(no_log=True, aliases=['tower_password'], required=False, fallback=(env_fallback, ['CONTROLLER_PASSWORD', 'TOWER_PASSWORD'])), - validate_certs=dict(type='bool', aliases=['tower_verify_ssl'], required=False, fallback=(env_fallback, ['CONTROLLER_VERIFY_SSL', 'TOWER_VERIFY_SSL'])), - controller_oauthtoken=dict(type='raw', no_log=True, aliases=['tower_oauthtoken'], required=False, fallback=(env_fallback, ['CONTROLLER_OAUTH_TOKEN', 'TOWER_OAUTH_TOKEN'])), - controller_config_file=dict(type='path', aliases=['tower_config_file'], required=False, default=None), + controller_host=dict( + required=False, + aliases=['tower_host'], + fallback=(env_fallback, ['CONTROLLER_HOST', 'TOWER_HOST'])), + controller_username=dict( + required=False, + aliases=['tower_username'], + fallback=(env_fallback, ['CONTROLLER_USERNAME', 'TOWER_USERNAME'])), + controller_password=dict( + no_log=True, + aliases=['tower_password'], + required=False, + fallback=(env_fallback, ['CONTROLLER_PASSWORD', 'TOWER_PASSWORD'])), + validate_certs=dict( + type='bool', + aliases=['tower_verify_ssl'], + required=False, + fallback=(env_fallback, ['CONTROLLER_VERIFY_SSL', 'TOWER_VERIFY_SSL'])), + controller_oauthtoken=dict( + type='raw', + no_log=True, + aliases=['tower_oauthtoken'], + required=False, + fallback=(env_fallback, ['CONTROLLER_OAUTH_TOKEN', 'TOWER_OAUTH_TOKEN'])), + controller_config_file=dict( + type='path', + aliases=['tower_config_file'], + required=False, + default=None), ) short_params = { 'host': 'controller_host', From 25ca8d22d61b7f671a929a48427e29d0c732dd9d Mon Sep 17 00:00:00 2001 From: Sarabraj Singh Date: Mon, 24 May 2021 13:02:43 -0400 Subject: [PATCH 18/31] added collection name to module.deprecate() calls; fixed pep8 linting issues --- awx_collection/plugins/module_utils/controller_api.py | 2 +- awx_collection/plugins/modules/credential.py | 10 ++++++++-- awx_collection/plugins/modules/job_wait.py | 1 + .../plugins/modules/notification_template.py | 4 +++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/awx_collection/plugins/module_utils/controller_api.py b/awx_collection/plugins/module_utils/controller_api.py index 61aad6712c..b63585f618 100644 --- a/awx_collection/plugins/module_utils/controller_api.py +++ b/awx_collection/plugins/module_utils/controller_api.py @@ -163,7 +163,7 @@ class ControllerAPIModule(ControllerModule): if len(sample['json']['results']) > 1: sample['json']['results'] = sample['json']['results'][:2] + ['...more results snipped...'] url = self.build_url(endpoint, query_params) - display_endpoint = url.geturl()[len(self.host) :] # truncate to not include the base URL + display_endpoint = url.geturl()[len(self.host):] # truncate to not include the base URL self.fail_json( msg="Request to {0} returned {1} items, expected 1".format(display_endpoint, response['json']['count']), query=query_params, diff --git a/awx_collection/plugins/modules/credential.py b/awx_collection/plugins/modules/credential.py index a32d656654..dfd9b572fc 100644 --- a/awx_collection/plugins/modules/credential.py +++ b/awx_collection/plugins/modules/credential.py @@ -398,9 +398,15 @@ def main(): # Deprecation warnings for legacy_input in OLD_INPUT_NAMES: if module.params.get(legacy_input) is not None: - module.deprecate(msg='{0} parameter has been deprecated, please use inputs instead'.format(legacy_input), version="ansible.tower:4.0.0") + module.deprecate( + collection_name=DOCUMENTATION.module, + msg='{0} parameter has been deprecated, please use inputs instead'.format(legacy_input), + version="4.0.0") if kind: - module.deprecate(msg='The kind parameter has been deprecated, please use credential_type instead', version="ansible.tower:4.0.0") + module.deprecate( + collection_name=DOCUMENTATION.module, + msg='The kind parameter has been deprecated, please use credential_type instead', + version="4.0.0") cred_type_id = module.resolve_name_to_id('credential_types', credential_type if credential_type else KIND_CHOICES[kind]) if organization: diff --git a/awx_collection/plugins/modules/job_wait.py b/awx_collection/plugins/modules/job_wait.py index 110bffc3c4..b444229ec1 100644 --- a/awx_collection/plugins/modules/job_wait.py +++ b/awx_collection/plugins/modules/job_wait.py @@ -132,6 +132,7 @@ def main(): max_interval = 30 interval = abs((min_interval + max_interval) / 2) module.deprecate( + collection_name=DOCUMENTATION.module, msg="Min and max interval have been deprecated, please use interval instead; interval will be set to {0}".format(interval), version="ansible.tower:4.0.0", ) diff --git a/awx_collection/plugins/modules/notification_template.py b/awx_collection/plugins/modules/notification_template.py index bc3b9b7f19..a3549a54c0 100644 --- a/awx_collection/plugins/modules/notification_template.py +++ b/awx_collection/plugins/modules/notification_template.py @@ -401,7 +401,9 @@ def main(): for legacy_input in OLD_INPUT_NAMES: if module.params.get(legacy_input) is not None: module.deprecate( - msg='{0} parameter has been deprecated, please use notification_configuration instead'.format(legacy_input), version="ansible.tower:4.0.0" + collection_name=DOCUMENTATION.module, + msg='{0} parameter has been deprecated, please use notification_configuration instead'.format(legacy_input), + version="4.0.0" ) # Attempt to look up the related items the user specified (these will fail the module if not found) From d2d511f596a5e6101d8805588d3738aea000f965 Mon Sep 17 00:00:00 2001 From: Sarabraj Singh Date: Mon, 24 May 2021 13:42:58 -0400 Subject: [PATCH 19/31] switched to semenatic versioning for version numbers in plugins, library and tools packages --- awx/playbooks/library/insights.py | 2 +- awx/playbooks/library/project_archive.py | 2 +- awx_collection/plugins/doc_fragments/auth.py | 2 +- awx_collection/plugins/modules/ad_hoc_command.py | 2 +- awx_collection/plugins/modules/credential_input_source.py | 2 +- awx_collection/plugins/modules/export.py | 2 +- awx_collection/plugins/modules/import.py | 2 +- awx_collection/plugins/modules/instance_group.py | 2 +- awx_collection/plugins/modules/token.py | 2 +- awx_collection/tools/roles/generate/templates/module.j2 | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/awx/playbooks/library/insights.py b/awx/playbooks/library/insights.py index 39d54b4e88..c1e2d08367 100644 --- a/awx/playbooks/library/insights.py +++ b/awx/playbooks/library/insights.py @@ -8,7 +8,7 @@ short_description: gather all maintenance plan playbooks for an insights account description: - Supply insights Credentials to download all playbooks for all maintenance plans. The totality of the plans are versioned based on the http ETag response. -version_added: "2.3" +version_added: "2.3.0" options: insights_url: description: diff --git a/awx/playbooks/library/project_archive.py b/awx/playbooks/library/project_archive.py index 001e2eec04..74301557a4 100644 --- a/awx/playbooks/library/project_archive.py +++ b/awx/playbooks/library/project_archive.py @@ -9,7 +9,7 @@ description: - Unpacks an archive that contains a project, in order to support handling versioned artifacts from (for example) GitHub Releases or Artifactory builds. - Handles projects in the archive root, or in a single base directory of the archive. -version_added: "2.9" +version_added: "2.9.0" options: src: description: diff --git a/awx_collection/plugins/doc_fragments/auth.py b/awx_collection/plugins/doc_fragments/auth.py index 52fec785c3..3cab718a7d 100644 --- a/awx_collection/plugins/doc_fragments/auth.py +++ b/awx_collection/plugins/doc_fragments/auth.py @@ -40,7 +40,7 @@ options: - A dictionary structure as returned by the token module. - If value not set, will try environment variable C(CONTROLLER_OAUTH_TOKEN) and then config files type: raw - version_added: "3.7" + version_added: "3.7.0" aliases: [ tower_oauthtoken ] validate_certs: description: diff --git a/awx_collection/plugins/modules/ad_hoc_command.py b/awx_collection/plugins/modules/ad_hoc_command.py index 355e60362b..43e2affe6c 100644 --- a/awx_collection/plugins/modules/ad_hoc_command.py +++ b/awx_collection/plugins/modules/ad_hoc_command.py @@ -16,7 +16,7 @@ DOCUMENTATION = ''' --- module: ad_hoc_command author: "John Westcott IV (@john-westcott-iv)" -version_added: "4.0" +version_added: "4.0.0" short_description: create, update, or destroy Automation Platform Controller ad hoc commands. description: - Create, update, or destroy Automation Platform Controller ad hoc commands. See diff --git a/awx_collection/plugins/modules/credential_input_source.py b/awx_collection/plugins/modules/credential_input_source.py index 4d57c4bf90..c7ace4f726 100644 --- a/awx_collection/plugins/modules/credential_input_source.py +++ b/awx_collection/plugins/modules/credential_input_source.py @@ -16,7 +16,7 @@ DOCUMENTATION = ''' --- module: credential_input_source author: "Tom Page (@Tompage1994)" -version_added: "2.3" +version_added: "2.3.0" short_description: create, update, or destroy Automation Platform Controller credential input sources. description: - Create, update, or destroy Automation Platform Controller credential input sources. See diff --git a/awx_collection/plugins/modules/export.py b/awx_collection/plugins/modules/export.py index f45bbd870d..46dafe7470 100644 --- a/awx_collection/plugins/modules/export.py +++ b/awx_collection/plugins/modules/export.py @@ -16,7 +16,7 @@ DOCUMENTATION = ''' --- module: export author: "John Westcott IV (@john-westcott-iv)" -version_added: "3.7" +version_added: "3.7.0" short_description: export resources from Automation Platform Controller. description: - Export assets from Automation Platform Controller. diff --git a/awx_collection/plugins/modules/import.py b/awx_collection/plugins/modules/import.py index c1e741ed77..3a8512cb2e 100644 --- a/awx_collection/plugins/modules/import.py +++ b/awx_collection/plugins/modules/import.py @@ -16,7 +16,7 @@ DOCUMENTATION = ''' --- module: import author: "John Westcott (@john-westcott-iv)" -version_added: "3.7" +version_added: "3.7.0" short_description: import resources into Automation Platform Controller. description: - Import assets into Automation Platform Controller. See diff --git a/awx_collection/plugins/modules/instance_group.py b/awx_collection/plugins/modules/instance_group.py index 4b7713d16c..bd511dbe13 100644 --- a/awx_collection/plugins/modules/instance_group.py +++ b/awx_collection/plugins/modules/instance_group.py @@ -16,7 +16,7 @@ DOCUMENTATION = ''' --- module: instance_group author: "John Westcott IV (@john-westcott-iv)" -version_added: "4.0" +version_added: "4.0.0" short_description: create, update, or destroy Automation Platform Controller instance groups. description: - Create, update, or destroy Automation Platform Controller instance groups. See diff --git a/awx_collection/plugins/modules/token.py b/awx_collection/plugins/modules/token.py index 8f695f431c..d225f10f91 100644 --- a/awx_collection/plugins/modules/token.py +++ b/awx_collection/plugins/modules/token.py @@ -16,7 +16,7 @@ DOCUMENTATION = ''' --- module: token author: "John Westcott IV (@john-westcott-iv)" -version_added: "2.3" +version_added: "2.3.0" short_description: create, update, or destroy Automation Platform Controller tokens. description: - Create or destroy Automation Platform Controller tokens. See diff --git a/awx_collection/tools/roles/generate/templates/module.j2 b/awx_collection/tools/roles/generate/templates/module.j2 index ea7b954053..407cbd8530 100644 --- a/awx_collection/tools/roles/generate/templates/module.j2 +++ b/awx_collection/tools/roles/generate/templates/module.j2 @@ -24,7 +24,7 @@ DOCUMENTATION = ''' --- module: tower_{{ singular_item_type }} author: "John Westcott IV (@john-westcott-iv)" -version_added: "4.0" +version_added: "4.0.0" short_description: create, update, or destroy Ansible Tower {{ human_readable }}. description: - Create, update, or destroy Ansible Tower {{ human_readable }}. See From 535bbfcc39918a16d7c4ea65f7dfb81b76e5b033 Mon Sep 17 00:00:00 2001 From: Sarabraj Singh Date: Tue, 25 May 2021 10:29:19 -0400 Subject: [PATCH 20/31] fixed validate-modules sanity tests --- awx_collection/plugins/modules/credential.py | 4 +-- awx_collection/plugins/modules/export.py | 12 +++++++ .../plugins/modules/instance_group.py | 8 +++-- awx_collection/plugins/modules/job_launch.py | 2 +- .../plugins/modules/job_template.py | 32 +++++++++---------- awx_collection/plugins/modules/license.py | 4 +-- awx_collection/plugins/modules/token.py | 2 +- .../plugins/modules/workflow_job_template.py | 1 + .../modules/workflow_job_template_node.py | 2 +- 9 files changed, 41 insertions(+), 26 deletions(-) diff --git a/awx_collection/plugins/modules/credential.py b/awx_collection/plugins/modules/credential.py index dfd9b572fc..170cab6fe9 100644 --- a/awx_collection/plugins/modules/credential.py +++ b/awx_collection/plugins/modules/credential.py @@ -360,10 +360,10 @@ def main(): project=dict(), ssh_key_data=dict(no_log=True), ssh_key_unlock=dict(no_log=True), - authorize=dict(type='bool'), + authorize=dict(type='bool', default=False), authorize_password=dict(no_log=True), client=dict(), - security_token=dict(), + security_token=dict(no_log=True), secret=dict(no_log=True), subscription=dict(), tenant=dict(), diff --git a/awx_collection/plugins/modules/export.py b/awx_collection/plugins/modules/export.py index 46dafe7470..72a59957e8 100644 --- a/awx_collection/plugins/modules/export.py +++ b/awx_collection/plugins/modules/export.py @@ -112,6 +112,18 @@ except ImportError: def main(): argument_spec = dict( all=dict(type='bool', default=False), + credential_types=dict(type='str'), + credentials=dict(type='str'), + execution_environments=dict(type='str'), + inventory=dict(type='str'), + inventory_sources=dict(type='str'), + job_templates=dict(type='str'), + notification_templates=dict(type='str'), + organizations=dict(type='str'), + projects=dict(type='str'), + teams=dict(type='str'), + users=dict(type='str'), + workflow_job_templates=dict(type='str'), ) # We are not going to raise an error here because the __init__ method of ControllerAWXKitModule will do that for us diff --git a/awx_collection/plugins/modules/instance_group.py b/awx_collection/plugins/modules/instance_group.py index bd511dbe13..e30db12d6a 100644 --- a/awx_collection/plugins/modules/instance_group.py +++ b/awx_collection/plugins/modules/instance_group.py @@ -58,6 +58,7 @@ options: - List of exact-match Instances that will be assigned to this group required: False type: list + elements: str pod_spec_override: description: - A custom Kubernetes or OpenShift Pod specification. @@ -68,6 +69,7 @@ options: - The instances associated with this instance_group required: False type: list + elements: str state: description: - Desired state of the resource. @@ -89,12 +91,12 @@ def main(): name=dict(required=True), new_name=dict(), credential=dict(), - is_container_group=dict(type='bool', default=False), + is_container_group=dict(type='bool', default=None), policy_instance_percentage=dict(type='int', default='0'), policy_instance_minimum=dict(type='int', default='0'), - policy_instance_list=dict(type='list'), + policy_instance_list=dict(type='list', elements='str'), pod_spec_override=dict(), - instances=dict(required=False, type="list", default=None), + instances=dict(required=False, type="list", elements='str', default=None), state=dict(choices=['present', 'absent'], default='present'), ) diff --git a/awx_collection/plugins/modules/job_launch.py b/awx_collection/plugins/modules/job_launch.py index 193e2c1e61..728609d11b 100644 --- a/awx_collection/plugins/modules/job_launch.py +++ b/awx_collection/plugins/modules/job_launch.py @@ -164,7 +164,7 @@ def main(): skip_tags=dict(type='list', elements='str'), verbosity=dict(type='int', choices=[0, 1, 2, 3, 4, 5]), diff_mode=dict(type='bool'), - credential_passwords=dict(type='dict'), + credential_passwords=dict(type='dict', no_log=True), wait=dict(default=False, type='bool'), interval=dict(default=1.0, type='float'), timeout=dict(default=None, type='int'), diff --git a/awx_collection/plugins/modules/job_template.py b/awx_collection/plugins/modules/job_template.py index 52010b48b7..7a6086d277 100644 --- a/awx_collection/plugins/modules/job_template.py +++ b/awx_collection/plugins/modules/job_template.py @@ -388,24 +388,24 @@ def main(): skip_tags=dict(), start_at_task=dict(), timeout=dict(type='int', default=0), - use_fact_cache=dict(type='bool', aliases=['fact_caching_enabled']), - host_config_key=dict(), - ask_diff_mode_on_launch=dict(type='bool', aliases=['ask_diff_mode']), - ask_variables_on_launch=dict(type='bool', aliases=['ask_extra_vars']), - ask_limit_on_launch=dict(type='bool', aliases=['ask_limit']), - ask_tags_on_launch=dict(type='bool', aliases=['ask_tags']), - ask_skip_tags_on_launch=dict(type='bool', aliases=['ask_skip_tags']), - ask_job_type_on_launch=dict(type='bool', aliases=['ask_job_type']), - ask_verbosity_on_launch=dict(type='bool', aliases=['ask_verbosity']), - ask_inventory_on_launch=dict(type='bool', aliases=['ask_inventory']), - ask_credential_on_launch=dict(type='bool', aliases=['ask_credential']), - survey_enabled=dict(type='bool'), + use_fact_cache=dict(type='bool', aliases=['fact_caching_enabled'], default=False), + host_config_key=dict(no_log=True), + ask_diff_mode_on_launch=dict(type='bool', aliases=['ask_diff_mode'], default=False), + ask_variables_on_launch=dict(type='bool', aliases=['ask_extra_vars'], default=False), + ask_limit_on_launch=dict(type='bool', aliases=['ask_limit'], default=False), + ask_tags_on_launch=dict(type='bool', aliases=['ask_tags'], default=False), + ask_skip_tags_on_launch=dict(type='bool', aliases=['ask_skip_tags'], default=False), + ask_job_type_on_launch=dict(type='bool', aliases=['ask_job_type'], default=False), + ask_verbosity_on_launch=dict(type='bool', aliases=['ask_verbosity'], default=False), + ask_inventory_on_launch=dict(type='bool', aliases=['ask_inventory'], default=False), + ask_credential_on_launch=dict(type='bool', aliases=['ask_credential'], default=False), + survey_enabled=dict(type='bool', default=False), survey_spec=dict(type="dict"), - become_enabled=dict(type='bool'), - diff_mode=dict(type='bool', aliases=['diff_mode_enabled']), - allow_simultaneous=dict(type='bool', aliases=['concurrent_jobs_enabled']), + become_enabled=dict(type='bool', default=False), + diff_mode=dict(type='bool', aliases=['diff_mode_enabled'], default=False), + allow_simultaneous=dict(type='bool', aliases=['concurrent_jobs_enabled'], default=False), scm_branch=dict(), - ask_scm_branch_on_launch=dict(type='bool'), + ask_scm_branch_on_launch=dict(type='bool', default=False), job_slice_count=dict(type='int', default='1'), webhook_service=dict(choices=['github', 'gitlab', '']), webhook_credential=dict(), diff --git a/awx_collection/plugins/modules/license.py b/awx_collection/plugins/modules/license.py index 9325fc0359..6ad3544d4e 100644 --- a/awx_collection/plugins/modules/license.py +++ b/awx_collection/plugins/modules/license.py @@ -29,7 +29,6 @@ options: description: - By default, the license manifest will only be applied if Tower is currently unlicensed or trial licensed. When force=true, the license is always applied. - required: True type: bool default: 'False' extends_documentation_fragment: awx.awx.auth @@ -52,7 +51,8 @@ def main(): module = ControllerAPIModule( argument_spec=dict( manifest=dict(type='str', required=True), - force=dict(type='bool', required=False), + eula_accepted=dict(type='bool', required=True), + force=dict(type='bool', default=False), ), ) diff --git a/awx_collection/plugins/modules/token.py b/awx_collection/plugins/modules/token.py index d225f10f91..0b3016e771 100644 --- a/awx_collection/plugins/modules/token.py +++ b/awx_collection/plugins/modules/token.py @@ -136,7 +136,7 @@ def main(): description=dict(), application=dict(), scope=dict(choices=['read', 'write'], default='write'), - existing_token=dict(type='dict'), + existing_token=dict(type='dict', no_log=True), existing_token_id=dict(), state=dict(choices=['present', 'absent'], default='present'), ) diff --git a/awx_collection/plugins/modules/workflow_job_template.py b/awx_collection/plugins/modules/workflow_job_template.py index 741397b99f..8a4c5d75ec 100644 --- a/awx_collection/plugins/modules/workflow_job_template.py +++ b/awx_collection/plugins/modules/workflow_job_template.py @@ -148,6 +148,7 @@ options: description: - A json list of nodes and their coresponding options. The following suboptions describe a single node. type: list + elements: dict suboptions: extra_data: description: diff --git a/awx_collection/plugins/modules/workflow_job_template_node.py b/awx_collection/plugins/modules/workflow_job_template_node.py index 9c950d3465..82dddb07e4 100644 --- a/awx_collection/plugins/modules/workflow_job_template_node.py +++ b/awx_collection/plugins/modules/workflow_job_template_node.py @@ -255,7 +255,7 @@ def main(): required_if = [ ['state', 'absent', ['identifier']], ['state', 'present', ['identifier']], - ['state', 'present', ['unified_job_template', 'approval_node', 'success_nodes', 'always_nodes', 'failure_nodes'], 'true'], + ['state', 'present', ['unified_job_template', 'approval_node', 'success_nodes', 'always_nodes', 'failure_nodes'], True], ] # Create a module for ourselves From 27a125488311cc9c0b32d12e2100724b1191f0ef Mon Sep 17 00:00:00 2001 From: Sarabraj Singh Date: Tue, 25 May 2021 16:14:25 -0400 Subject: [PATCH 21/31] fixed ansible-test sanity import tests; removed sanity-ignore files --- .../plugins/lookup/schedule_rrule.py | 35 ++++++++----------- awx_collection/tests/sanity/ignore-2.10.txt | 16 --------- awx_collection/tests/sanity/ignore-2.11.txt | 1 - awx_collection/tests/sanity/ignore-2.9.txt | 10 ------ 4 files changed, 15 insertions(+), 47 deletions(-) delete mode 100644 awx_collection/tests/sanity/ignore-2.10.txt delete mode 100644 awx_collection/tests/sanity/ignore-2.11.txt delete mode 100644 awx_collection/tests/sanity/ignore-2.9.txt diff --git a/awx_collection/plugins/lookup/schedule_rrule.py b/awx_collection/plugins/lookup/schedule_rrule.py index 4b5dd7fe73..2021195ec8 100644 --- a/awx_collection/plugins/lookup/schedule_rrule.py +++ b/awx_collection/plugins/lookup/schedule_rrule.py @@ -84,35 +84,22 @@ _raw: - String in the rrule format type: string """ +import re +from ansible.module_utils.six import raise_from from ansible.plugins.lookup import LookupBase from ansible.errors import AnsibleError from datetime import datetime -import re +from dateutil import rrule from distutils.version import LooseVersion -missing_modules = [] try: import pytz -except ImportError: - missing_modules.append('pytz') - -try: from dateutil import rrule -except ImportError: - missing_modules.append('python.dateutil') - -# Validate the version of python.dateutil -try: - import dateutil - - if LooseVersion(dateutil.__version__) < LooseVersion("2.7.0"): - raise Exception -except Exception: - missing_modules.append('python.dateutil>=2.7.0') - -if len(missing_modules) > 0: - raise AnsibleError('You are missing the modules {0}'.format(', '.join(missing_modules))) +except ImportError as imp_exc: + LIBRARY_IMPORT_ERROR = imp_exc +else: + LIBRARY_IMPORT_ERROR = None class LookupModule(LookupBase): @@ -143,6 +130,14 @@ class LookupModule(LookupBase): 'last': -1, } + # plugin constructor + def __init__(self): + if self.LIBRARY_IMPORT_ERROR: + raise_from( + AnsibleError('{0}'.format(LIBRARY_IMPORT_ERROR)), + LIBRARY_IMPORT_ERROR + ) + @staticmethod def parse_date_time(date_string): try: diff --git a/awx_collection/tests/sanity/ignore-2.10.txt b/awx_collection/tests/sanity/ignore-2.10.txt deleted file mode 100644 index b990470a8d..0000000000 --- a/awx_collection/tests/sanity/ignore-2.10.txt +++ /dev/null @@ -1,16 +0,0 @@ -plugins/modules/receive.py validate-modules:deprecation-mismatch -plugins/modules/send.py validate-modules:deprecation-mismatch -plugins/modules/workflow_template.py validate-modules:deprecation-mismatch -plugins/modules/credential.py pylint:wrong-collection-deprecated-version-tag -plugins/modules/job_wait.py pylint:wrong-collection-deprecated-version-tag -plugins/modules/notification_template.py pylint:wrong-collection-deprecated-version-tag -plugins/inventory/controller.py pylint:raise-missing-from -plugins/inventory/controller.py pylint:super-with-arguments -plugins/lookup/schedule_rrule.py pylint:raise-missing-from -plugins/module_utils/controller_api.py pylint:super-with-arguments -plugins/module_utils/awxkit.py pylint:super-with-arguments -plugins/module_utils/tower_legacy.py pylint:super-with-arguments -plugins/module_utils/controller_module.py pylint:super-with-arguments -plugins/module_utils/controller_module.py pylint:raise-missing-from -test/awx/conftest.py pylint:raise-missing-from -plugins/module_utils/controller_api.py pep8:E203 diff --git a/awx_collection/tests/sanity/ignore-2.11.txt b/awx_collection/tests/sanity/ignore-2.11.txt deleted file mode 100644 index 6964b9b84c..0000000000 --- a/awx_collection/tests/sanity/ignore-2.11.txt +++ /dev/null @@ -1 +0,0 @@ -plugins/module_utils/controller_api.py pep8:E203 diff --git a/awx_collection/tests/sanity/ignore-2.9.txt b/awx_collection/tests/sanity/ignore-2.9.txt deleted file mode 100644 index f5e44180b6..0000000000 --- a/awx_collection/tests/sanity/ignore-2.9.txt +++ /dev/null @@ -1,10 +0,0 @@ -plugins/inventory/controller.py pylint:raise-missing-from -plugins/inventory/controller.py pylint:super-with-arguments -plugins/lookup/schedule_rrule.py pylint:raise-missing-from -plugins/module_utils/controller_api.py pylint:super-with-arguments -plugins/module_utils/awxkit.py pylint:super-with-arguments -plugins/module_utils/tower_legacy.py pylint:super-with-arguments -plugins/module_utils/controller_module.py pylint:super-with-arguments -plugins/module_utils/controller_module.py pylint:raise-missing-from -test/awx/conftest.py pylint:raise-missing-from -plugins/module_utils/controller_api.py pep8:E203 \ No newline at end of file From b26e33ca3472c5df87c88128c7e855f66306015e Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Thu, 27 May 2021 18:33:56 -0400 Subject: [PATCH 22/31] remove eula_accepted --- awx_collection/plugins/modules/license.py | 1 - 1 file changed, 1 deletion(-) diff --git a/awx_collection/plugins/modules/license.py b/awx_collection/plugins/modules/license.py index 6ad3544d4e..c75bad18c6 100644 --- a/awx_collection/plugins/modules/license.py +++ b/awx_collection/plugins/modules/license.py @@ -51,7 +51,6 @@ def main(): module = ControllerAPIModule( argument_spec=dict( manifest=dict(type='str', required=True), - eula_accepted=dict(type='bool', required=True), force=dict(type='bool', default=False), ), ) From 157adb828e91350adac568e83861d45430f70568 Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Wed, 2 Jun 2021 12:44:16 -0400 Subject: [PATCH 23/31] various sanity fixes --- awx_collection/plugins/lookup/schedule_rrule.py | 7 ++++--- awx_collection/plugins/modules/credential.py | 7 +++---- awx_collection/plugins/modules/job_wait.py | 4 ++-- awx_collection/plugins/modules/notification_template.py | 2 +- awx_collection/plugins/modules/token.py | 2 +- .../tests/integration/targets/token/tasks/main.yml | 8 ++++---- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/awx_collection/plugins/lookup/schedule_rrule.py b/awx_collection/plugins/lookup/schedule_rrule.py index 2021195ec8..91619b20a1 100644 --- a/awx_collection/plugins/lookup/schedule_rrule.py +++ b/awx_collection/plugins/lookup/schedule_rrule.py @@ -10,7 +10,7 @@ DOCUMENTATION = """ short_description: Generate an rrule string which can be used for Schedules requirements: - pytz - - python.dateutil >= 2.7.0 + - python-dateutil >= 2.7.0 description: - Returns a string based on criteria which represents an rrule options: @@ -131,12 +131,13 @@ class LookupModule(LookupBase): } # plugin constructor - def __init__(self): - if self.LIBRARY_IMPORT_ERROR: + def __init__(self, *args, **kwargs): + if LIBRARY_IMPORT_ERROR: raise_from( AnsibleError('{0}'.format(LIBRARY_IMPORT_ERROR)), LIBRARY_IMPORT_ERROR ) + super().__init__(*args, *kwargs) @staticmethod def parse_date_time(date_string): diff --git a/awx_collection/plugins/modules/credential.py b/awx_collection/plugins/modules/credential.py index 170cab6fe9..d11ce62e49 100644 --- a/awx_collection/plugins/modules/credential.py +++ b/awx_collection/plugins/modules/credential.py @@ -120,7 +120,6 @@ options: - Should use authorize for net type. - Deprecated, please use inputs type: bool - default: 'no' authorize_password: description: - Password for net credentials that require authorize. @@ -360,7 +359,7 @@ def main(): project=dict(), ssh_key_data=dict(no_log=True), ssh_key_unlock=dict(no_log=True), - authorize=dict(type='bool', default=False), + authorize=dict(type='bool'), authorize_password=dict(no_log=True), client=dict(), security_token=dict(no_log=True), @@ -399,12 +398,12 @@ def main(): for legacy_input in OLD_INPUT_NAMES: if module.params.get(legacy_input) is not None: module.deprecate( - collection_name=DOCUMENTATION.module, + collection_name="awx.awx", msg='{0} parameter has been deprecated, please use inputs instead'.format(legacy_input), version="4.0.0") if kind: module.deprecate( - collection_name=DOCUMENTATION.module, + collection_name="awx.awx", msg='The kind parameter has been deprecated, please use credential_type instead', version="4.0.0") diff --git a/awx_collection/plugins/modules/job_wait.py b/awx_collection/plugins/modules/job_wait.py index b444229ec1..c7967d0322 100644 --- a/awx_collection/plugins/modules/job_wait.py +++ b/awx_collection/plugins/modules/job_wait.py @@ -132,9 +132,9 @@ def main(): max_interval = 30 interval = abs((min_interval + max_interval) / 2) module.deprecate( - collection_name=DOCUMENTATION.module, + collection_name="awx.awx", msg="Min and max interval have been deprecated, please use interval instead; interval will be set to {0}".format(interval), - version="ansible.tower:4.0.0", + version="4.0.0", ) # Attempt to look up job based on the provided id diff --git a/awx_collection/plugins/modules/notification_template.py b/awx_collection/plugins/modules/notification_template.py index a3549a54c0..618a9af6b4 100644 --- a/awx_collection/plugins/modules/notification_template.py +++ b/awx_collection/plugins/modules/notification_template.py @@ -401,7 +401,7 @@ def main(): for legacy_input in OLD_INPUT_NAMES: if module.params.get(legacy_input) is not None: module.deprecate( - collection_name=DOCUMENTATION.module, + collection_name="awx.awx", msg='{0} parameter has been deprecated, please use notification_configuration instead'.format(legacy_input), version="4.0.0" ) diff --git a/awx_collection/plugins/modules/token.py b/awx_collection/plugins/modules/token.py index 0b3016e771..0df08e0c65 100644 --- a/awx_collection/plugins/modules/token.py +++ b/awx_collection/plugins/modules/token.py @@ -136,7 +136,7 @@ def main(): description=dict(), application=dict(), scope=dict(choices=['read', 'write'], default='write'), - existing_token=dict(type='dict', no_log=True), + existing_token=dict(type='dict', no_log=False), existing_token_id=dict(), state=dict(choices=['present', 'absent'], default='present'), ) diff --git a/awx_collection/tests/integration/targets/token/tasks/main.yml b/awx_collection/tests/integration/targets/token/tasks/main.yml index 6769e7f232..5efa9e37b3 100644 --- a/awx_collection/tests/integration/targets/token/tasks/main.yml +++ b/awx_collection/tests/integration/targets/token/tasks/main.yml @@ -63,19 +63,19 @@ - name: Validate our token works by token job_list: - oauthtoken: "{{ tower_token.token }}" + controller_oauthtoken: "{{ tower_token.token }}" register: job_list - name: Validate our token works by object job_list: - oauthtoken: "{{ tower_token }}" + controller_oauthtoken: "{{ tower_token }}" register: job_list always: - name: Delete our Token with our own token token: existing_token: "{{ tower_token }}" - oauthtoken: "{{ tower_token }}" + controller_oauthtoken: "{{ tower_token }}" state: absent when: tower_token is defined register: results @@ -100,7 +100,7 @@ - name: Delete the second Token with our own token token: existing_token_id: "{{ tower_token['id'] }}" - oauthtoken: "{{ tower_token }}" + controller_oauthtoken: "{{ tower_token }}" state: absent when: tower_token is defined register: results From cd100fd77014edda652da8842530977a0d88aa4f Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Wed, 2 Jun 2021 19:57:55 -0400 Subject: [PATCH 24/31] fix super and kwargs --- awx_collection/plugins/lookup/schedule_rrule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx_collection/plugins/lookup/schedule_rrule.py b/awx_collection/plugins/lookup/schedule_rrule.py index 91619b20a1..1b40f99474 100644 --- a/awx_collection/plugins/lookup/schedule_rrule.py +++ b/awx_collection/plugins/lookup/schedule_rrule.py @@ -137,7 +137,7 @@ class LookupModule(LookupBase): AnsibleError('{0}'.format(LIBRARY_IMPORT_ERROR)), LIBRARY_IMPORT_ERROR ) - super().__init__(*args, *kwargs) + super(LookupModule, self).__init__(*args, **kwargs) @staticmethod def parse_date_time(date_string): From 4bd910493affb1a9be4aa5e1ca9a9082cdf5f05c Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Thu, 3 Jun 2021 16:28:12 -0400 Subject: [PATCH 25/31] sanity tests --- .../plugins/inventory/controller.py | 6 +-- .../plugins/lookup/schedule_rrule.py | 6 +-- awx_collection/plugins/module_utils/awxkit.py | 2 +- .../plugins/module_utils/controller_api.py | 2 +- .../plugins/module_utils/controller_module.py | 12 ++--- .../plugins/module_utils/tower_legacy.py | 2 +- awx_collection/plugins/modules/credential.py | 2 +- .../plugins/modules/instance_group.py | 3 +- awx_collection/plugins/modules/job_launch.py | 2 +- .../plugins/modules/job_template.py | 47 +++++++------------ awx_collection/test/awx/conftest.py | 2 +- 11 files changed, 36 insertions(+), 50 deletions(-) diff --git a/awx_collection/plugins/inventory/controller.py b/awx_collection/plugins/inventory/controller.py index f5719a579a..40ed2b97ac 100644 --- a/awx_collection/plugins/inventory/controller.py +++ b/awx_collection/plugins/inventory/controller.py @@ -89,7 +89,7 @@ class InventoryModule(BaseInventoryPlugin): if path.endswith('@controller_inventory') or path.endswith('@tower_inventory'): self.no_config_file_supplied = True return True - elif super(InventoryModule, self).verify_file(path): + elif super().verify_file(path): return path.endswith( ( 'controller_inventory.yml', @@ -109,7 +109,7 @@ class InventoryModule(BaseInventoryPlugin): self.display.warning(warning) def parse(self, inventory, loader, path, cache=True): - super(InventoryModule, self).parse(inventory, loader, path) + super().parse(inventory, loader, path) if not self.no_config_file_supplied and os.path.isfile(path): self._read_config_data(path) @@ -132,7 +132,7 @@ class InventoryModule(BaseInventoryPlugin): except ValueError as e: raise AnsibleOptionsError( 'Invalid type for configuration option inventory_id, ' 'not integer, and cannot convert to string: {err}'.format(err=to_native(e)) - ) + ) from e inventory_id = inventory_id.replace('/', '') inventory_url = '/api/v2/inventories/{inv_id}/script/'.format(inv_id=inventory_id) diff --git a/awx_collection/plugins/lookup/schedule_rrule.py b/awx_collection/plugins/lookup/schedule_rrule.py index 1b40f99474..964a1e893a 100644 --- a/awx_collection/plugins/lookup/schedule_rrule.py +++ b/awx_collection/plugins/lookup/schedule_rrule.py @@ -137,7 +137,7 @@ class LookupModule(LookupBase): AnsibleError('{0}'.format(LIBRARY_IMPORT_ERROR)), LIBRARY_IMPORT_ERROR ) - super(LookupModule, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) @staticmethod def parse_date_time(date_string): @@ -169,8 +169,8 @@ class LookupModule(LookupBase): if 'start_date' in kwargs: try: rrule_kwargs['dtstart'] = LookupModule.parse_date_time(kwargs['start_date']) - except Exception: - raise AnsibleError('Parameter start_date must be in the format YYYY-MM-DD [HH:MM:SS]') + except Exception as e: + raise AnsibleError('Parameter start_date must be in the format YYYY-MM-DD [HH:MM:SS]') from e # If we are a none frequency we don't need anything else if frequency == 'none': diff --git a/awx_collection/plugins/module_utils/awxkit.py b/awx_collection/plugins/module_utils/awxkit.py index 31902e6b15..ee3791d7e3 100644 --- a/awx_collection/plugins/module_utils/awxkit.py +++ b/awx_collection/plugins/module_utils/awxkit.py @@ -22,7 +22,7 @@ class ControllerAWXKitModule(ControllerModule): def __init__(self, argument_spec, **kwargs): kwargs['supports_check_mode'] = False - super(ControllerAWXKitModule, self).__init__(argument_spec=argument_spec, **kwargs) + super().__init__(argument_spec=argument_spec, **kwargs) # Die if we don't have AWX_KIT installed if not HAS_AWX_KIT: diff --git a/awx_collection/plugins/module_utils/controller_api.py b/awx_collection/plugins/module_utils/controller_api.py index b63585f618..2cd98c5a5c 100644 --- a/awx_collection/plugins/module_utils/controller_api.py +++ b/awx_collection/plugins/module_utils/controller_api.py @@ -30,7 +30,7 @@ class ControllerAPIModule(ControllerModule): def __init__(self, argument_spec, direct_params=None, error_callback=None, warn_callback=None, **kwargs): kwargs['supports_check_mode'] = True - super(ControllerAPIModule, self).__init__( + super().__init__( argument_spec=argument_spec, direct_params=direct_params, error_callback=error_callback, warn_callback=warn_callback, **kwargs ) self.session = Request(cookies=CookieJar(), validate_certs=self.verify_ssl) diff --git a/awx_collection/plugins/module_utils/controller_module.py b/awx_collection/plugins/module_utils/controller_module.py index 0fbae9ff50..6b8ced4818 100644 --- a/awx_collection/plugins/module_utils/controller_module.py +++ b/awx_collection/plugins/module_utils/controller_module.py @@ -95,7 +95,7 @@ class ControllerModule(AnsibleModule): if direct_params is not None: self.params = direct_params else: - super(ControllerModule, self).__init__(argument_spec=full_argspec, **kwargs) + super().__init__(argument_spec=full_argspec, **kwargs) self.load_config_files() @@ -238,10 +238,10 @@ class ControllerModule(AnsibleModule): pass except Exception as e: - raise ConfigFileException("An unknown exception occured trying to ini load config file: {0}".format(e)) + raise ConfigFileException("An unknown exception occured trying to ini load config file: {0}".format(e)) from e except Exception as e: - raise ConfigFileException("An unknown exception occured trying to load config file: {0}".format(e)) + raise ConfigFileException("An unknown exception occured trying to load config file: {0}".format(e)) from e # If we made it here, we have a dict which has values in it from our config, any final settings logic can be performed here for honorred_setting in self.short_params: @@ -265,15 +265,15 @@ class ControllerModule(AnsibleModule): if self.error_callback: self.error_callback(**kwargs) else: - super(ControllerModule, self).fail_json(**kwargs) + super().fail_json(**kwargs) def exit_json(self, **kwargs): # Try to log out if we are authenticated self.logout() - super(ControllerModule, self).exit_json(**kwargs) + super().exit_json(**kwargs) def warn(self, warning): if self.warn_callback is not None: self.warn_callback(warning) else: - super(ControllerModule, self).warn(warning) + super().warn(warning) diff --git a/awx_collection/plugins/module_utils/tower_legacy.py b/awx_collection/plugins/module_utils/tower_legacy.py index faed980a8a..84205c0f80 100644 --- a/awx_collection/plugins/module_utils/tower_legacy.py +++ b/awx_collection/plugins/module_utils/tower_legacy.py @@ -113,7 +113,7 @@ class TowerLegacyModule(AnsibleModule): ) ) - super(TowerLegacyModule, self).__init__(argument_spec=args, **kwargs) + super().__init__(argument_spec=args, **kwargs) if not HAS_TOWER_CLI: self.fail_json(msg=missing_required_lib('ansible-tower-cli'), exception=TOWER_CLI_IMP_ERR) diff --git a/awx_collection/plugins/modules/credential.py b/awx_collection/plugins/modules/credential.py index d11ce62e49..a913512d3b 100644 --- a/awx_collection/plugins/modules/credential.py +++ b/awx_collection/plugins/modules/credential.py @@ -362,7 +362,7 @@ def main(): authorize=dict(type='bool'), authorize_password=dict(no_log=True), client=dict(), - security_token=dict(no_log=True), + security_token=dict(no_log=False), secret=dict(no_log=True), subscription=dict(), tenant=dict(), diff --git a/awx_collection/plugins/modules/instance_group.py b/awx_collection/plugins/modules/instance_group.py index e30db12d6a..5daba3a975 100644 --- a/awx_collection/plugins/modules/instance_group.py +++ b/awx_collection/plugins/modules/instance_group.py @@ -41,6 +41,7 @@ options: - Signifies that this InstanceGroup should act as a ContainerGroup. If no credential is specified, the underlying Pod's ServiceAccount will be used. required: False type: bool + default: False policy_instance_percentage: description: - Minimum percentage of all instances that will be automatically assigned to this group when new instances come online. @@ -91,7 +92,7 @@ def main(): name=dict(required=True), new_name=dict(), credential=dict(), - is_container_group=dict(type='bool', default=None), + is_container_group=dict(type='bool', default=False), policy_instance_percentage=dict(type='int', default='0'), policy_instance_minimum=dict(type='int', default='0'), policy_instance_list=dict(type='list', elements='str'), diff --git a/awx_collection/plugins/modules/job_launch.py b/awx_collection/plugins/modules/job_launch.py index 728609d11b..83388fef85 100644 --- a/awx_collection/plugins/modules/job_launch.py +++ b/awx_collection/plugins/modules/job_launch.py @@ -164,7 +164,7 @@ def main(): skip_tags=dict(type='list', elements='str'), verbosity=dict(type='int', choices=[0, 1, 2, 3, 4, 5]), diff_mode=dict(type='bool'), - credential_passwords=dict(type='dict', no_log=True), + credential_passwords=dict(type='dict', no_log=False), wait=dict(default=False, type='bool'), interval=dict(default=1.0, type='float'), timeout=dict(default=None, type='int'), diff --git a/awx_collection/plugins/modules/job_template.py b/awx_collection/plugins/modules/job_template.py index 7a6086d277..3ffbbd2f3a 100644 --- a/awx_collection/plugins/modules/job_template.py +++ b/awx_collection/plugins/modules/job_template.py @@ -140,12 +140,10 @@ options: type: bool aliases: - diff_mode_enabled - default: 'no' use_fact_cache: description: - Enable use of fact caching for the job template. type: bool - default: 'no' aliases: - fact_caching_enabled host_config_key: @@ -156,75 +154,64 @@ options: description: - Prompt user for (scm branch) on launch. type: bool - default: 'False' ask_diff_mode_on_launch: description: - Prompt user to enable diff mode (show changes) to files when supported by modules. type: bool - default: 'False' aliases: - ask_diff_mode ask_variables_on_launch: description: - Prompt user for (extra_vars) on launch. type: bool - default: 'False' aliases: - ask_extra_vars ask_limit_on_launch: description: - Prompt user for a limit on launch. type: bool - default: 'False' aliases: - ask_limit ask_tags_on_launch: description: - Prompt user for job tags on launch. type: bool - default: 'False' aliases: - ask_tags ask_skip_tags_on_launch: description: - Prompt user for job tags to skip on launch. type: bool - default: 'False' aliases: - ask_skip_tags ask_job_type_on_launch: description: - Prompt user for job type on launch. type: bool - default: 'False' aliases: - ask_job_type ask_verbosity_on_launch: description: - Prompt user to choose a verbosity level on launch. type: bool - default: 'False' aliases: - ask_verbosity ask_inventory_on_launch: description: - Prompt user for inventory on launch. type: bool - default: 'False' aliases: - ask_inventory ask_credential_on_launch: description: - Prompt user for credential on launch. type: bool - default: 'False' aliases: - ask_credential survey_enabled: description: - Enable a survey on the job template. type: bool - default: 'no' survey_spec: description: - JSON/YAML dict formatted survey definition. @@ -233,12 +220,10 @@ options: description: - Activate privilege escalation. type: bool - default: 'no' allow_simultaneous: description: - Allow simultaneous runs of the job template. type: bool - default: 'no' aliases: - concurrent_jobs_enabled timeout: @@ -388,24 +373,24 @@ def main(): skip_tags=dict(), start_at_task=dict(), timeout=dict(type='int', default=0), - use_fact_cache=dict(type='bool', aliases=['fact_caching_enabled'], default=False), - host_config_key=dict(no_log=True), - ask_diff_mode_on_launch=dict(type='bool', aliases=['ask_diff_mode'], default=False), - ask_variables_on_launch=dict(type='bool', aliases=['ask_extra_vars'], default=False), - ask_limit_on_launch=dict(type='bool', aliases=['ask_limit'], default=False), - ask_tags_on_launch=dict(type='bool', aliases=['ask_tags'], default=False), - ask_skip_tags_on_launch=dict(type='bool', aliases=['ask_skip_tags'], default=False), - ask_job_type_on_launch=dict(type='bool', aliases=['ask_job_type'], default=False), - ask_verbosity_on_launch=dict(type='bool', aliases=['ask_verbosity'], default=False), - ask_inventory_on_launch=dict(type='bool', aliases=['ask_inventory'], default=False), - ask_credential_on_launch=dict(type='bool', aliases=['ask_credential'], default=False), - survey_enabled=dict(type='bool', default=False), + use_fact_cache=dict(type='bool', aliases=['fact_caching_enabled']), + host_config_key=dict(no_log=False), + ask_diff_mode_on_launch=dict(type='bool', aliases=['ask_diff_mode']), + ask_variables_on_launch=dict(type='bool', aliases=['ask_extra_vars']), + ask_limit_on_launch=dict(type='bool', aliases=['ask_limit']), + ask_tags_on_launch=dict(type='bool', aliases=['ask_tags']), + ask_skip_tags_on_launch=dict(type='bool', aliases=['ask_skip_tags']), + ask_job_type_on_launch=dict(type='bool', aliases=['ask_job_type']), + ask_verbosity_on_launch=dict(type='bool', aliases=['ask_verbosity']), + ask_inventory_on_launch=dict(type='bool', aliases=['ask_inventory']), + ask_credential_on_launch=dict(type='bool', aliases=['ask_credential']), + survey_enabled=dict(type='bool'), survey_spec=dict(type="dict"), - become_enabled=dict(type='bool', default=False), - diff_mode=dict(type='bool', aliases=['diff_mode_enabled'], default=False), - allow_simultaneous=dict(type='bool', aliases=['concurrent_jobs_enabled'], default=False), + become_enabled=dict(type='bool'), + diff_mode=dict(type='bool', aliases=['diff_mode_enabled']), + allow_simultaneous=dict(type='bool', aliases=['concurrent_jobs_enabled']), scm_branch=dict(), - ask_scm_branch_on_launch=dict(type='bool', default=False), + ask_scm_branch_on_launch=dict(type='bool'), job_slice_count=dict(type='int', default='1'), webhook_service=dict(choices=['github', 'gitlab', '']), webhook_credential=dict(), diff --git a/awx_collection/test/awx/conftest.py b/awx_collection/test/awx/conftest.py index 515114d2ca..dcd75fee11 100644 --- a/awx_collection/test/awx/conftest.py +++ b/awx_collection/test/awx/conftest.py @@ -184,7 +184,7 @@ def run_module(request, collection_import): try: result = json.loads(module_stdout) except Exception as e: - raise Exception('Module did not write valid JSON, error: {0}, stdout:\n{1}'.format(str(e), module_stdout)) + raise Exception('Module did not write valid JSON, error: {0}, stdout:\n{1}'.format(str(e), module_stdout)) from e # A module exception should never be a test expectation if 'exception' in result: if "ModuleNotFoundError: No module named 'tower_cli'" in result['exception']: From f06485feca58bfad634d71e1ea2cb96bf0607a51 Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Fri, 4 Jun 2021 13:03:59 -0400 Subject: [PATCH 26/31] fqcn redirects, and raise from sanity test fix --- awx_collection/meta/runtime.yml | 82 +++++++++++++++++++ .../plugins/lookup/schedule_rrule.py | 12 +-- .../roles/template_galaxy/tasks/main.yml | 4 +- 3 files changed, 90 insertions(+), 8 deletions(-) diff --git a/awx_collection/meta/runtime.yml b/awx_collection/meta/runtime.yml index 2fad1211f5..430d7dad74 100644 --- a/awx_collection/meta/runtime.yml +++ b/awx_collection/meta/runtime.yml @@ -38,6 +38,7 @@ plugin_routing: tower_schedule_rrule: redirect: awx.awx.schedule_rrule modules: + # if playbook does not specify a FQCN tower_ad_hoc_command_cancel: redirect: awx.awx.ad_hoc_command_cancel tower_ad_hoc_command_wait: @@ -118,3 +119,84 @@ plugin_routing: redirect: awx.awx.workflow_launch tower_workflow_node_wait: redirect: awx.awx.workflow_node_wait + # if playbook specifies a FQCN + awx.awx.tower_ad_hoc_command_cancel: + redirect: awx.awx.ad_hoc_command_cancel + awx.awx.tower_ad_hoc_command_wait: + redirect: awx.awx.ad_hoc_command_wait + awx.awx.tower_ad_hoc_command: + redirect: awx.awx.ad_hoc_command + awx.awx.tower_application: + redirect: awx.awx.application + awx.awx.tower_meta: + redirect: awx.awx.controller_meta + awx.awx.tower_credential_input_source: + redirect: awx.awx.credential_input_source + awx.awx.tower_credential_type: + redirect: awx.awx.credential_type + awx.awx.tower_credential: + redirect: awx.awx.credential + awx.awx.tower_execution_environment: + redirect: awx.awx.execution_environment + awx.awx.tower_export: + redirect: awx.awx.export + awx.awx.tower_group: + redirect: awx.awx.group + awx.awx.tower_host: + redirect: awx.awx.host + awx.awx.tower_import: + redirect: awx.awx.import + awx.awx.tower_instance_group: + redirect: awx.awx.instance_group + awx.awx.tower_inventory_source_update: + redirect: awx.awx.inventory_source_update + awx.awx.tower_inventory_source: + redirect: awx.awx.inventory_source + awx.awx.tower_inventory: + redirect: awx.awx.inventory + awx.awx.tower_job_cancel: + redirect: awx.awx.job_cancel + awx.awx.tower_job_launch: + redirect: awx.awx.job_launch + awx.awx.tower_job_list: + redirect: awx.awx.job_list + awx.awx.tower_job_template: + redirect: awx.awx.job_template + awx.awx.tower_job_wait: + redirect: awx.awx.job_wait + awx.awx.tower_label: + redirect: awx.awx.label + awx.awx.tower_license: + redirect: awx.awx.license + awx.awx.tower_notification_template: + redirect: awx.awx.notification_template + awx.awx.tower_notification: + redirect: awx.awx.notification_template + awx.awx.tower_organization: + redirect: awx.awx.organization + awx.awx.tower_project_update: + redirect: awx.awx.project_update + awx.awx.tower_project: + redirect: awx.awx.project + awx.awx.tower_role: + redirect: awx.awx.role + awx.awx.tower_schedule: + redirect: awx.awx.schedule + awx.awx.tower_settings: + redirect: awx.awx.settings + awx.awx.tower_team: + redirect: awx.awx.team + awx.awx.tower_token: + redirect: awx.awx.token + awx.awx.tower_user: + redirect: awx.awx.user + awx.awx.tower_workflow_approval: + redirect: awx.awx.workflow_approval + awx.awx.tower_workflow_job_template_node: + redirect: awx.awx.workflow_job_template_node + awx.awx.tower_workflow_job_template: + redirect: awx.awx.workflow_job_template + awx.awx.tower_workflow_launch: + redirect: awx.awx.workflow_launch + awx.awx.tower_workflow_node_wait: + redirect: awx.awx.workflow_node_wait diff --git a/awx_collection/plugins/lookup/schedule_rrule.py b/awx_collection/plugins/lookup/schedule_rrule.py index 964a1e893a..27f0491e61 100644 --- a/awx_collection/plugins/lookup/schedule_rrule.py +++ b/awx_collection/plugins/lookup/schedule_rrule.py @@ -184,8 +184,8 @@ class LookupModule(LookupBase): else: try: rrule_kwargs['until'] = LookupModule.parse_date_time(end_on) - except Exception: - raise AnsibleError('Parameter end_on must either be an integer or in the format YYYY-MM-DD [HH:MM:SS]') + except Exception as e: + raise AnsibleError('Parameter end_on must either be an integer or in the format YYYY-MM-DD [HH:MM:SS]') from e # A week-based frequency can also take the on_days parameter if frequency == 'week' and 'on_days' in kwargs: @@ -208,16 +208,16 @@ class LookupModule(LookupBase): my_month_day = int(kwargs['month_day_number']) if my_month_day < 1 or my_month_day > 31: raise Exception() - except Exception: - raise AnsibleError('month_day_number must be between 1 and 31') + except Exception as e: + raise AnsibleError('month_day_number must be between 1 and 31') from e rrule_kwargs['bymonthday'] = my_month_day if 'on_the' in kwargs: try: (occurance, weekday) = kwargs['on_the'].split(' ') - except Exception: - raise AnsibleError('on_the parameter must be two words separated by a space') + except Exception as e: + raise AnsibleError('on_the parameter must be two words separated by a space') from e if weekday not in LookupModule.weekdays: raise AnsibleError('Weekday portion of on_the parameter is not valid') diff --git a/awx_collection/tools/roles/template_galaxy/tasks/main.yml b/awx_collection/tools/roles/template_galaxy/tasks/main.yml index b53d339771..aaa21a023f 100644 --- a/awx_collection/tools/roles/template_galaxy/tasks/main.yml +++ b/awx_collection/tools/roles/template_galaxy/tasks/main.yml @@ -37,8 +37,8 @@ - name: Change runtime.yml redirect destinations replace: path: "{{ collection_path }}/meta/runtime.yml" - regexp: "redirect: awx.awx." - replace: "redirect: {{ collection_namespace }}.{{ collection_package }}." + regexp: "awx.awx." + replace: "{{ collection_namespace }}.{{ collection_package }}." - name: get list of test files find: From 199b4b6b47b8e20baedec0faf30738e38f2b9c8d Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Mon, 7 Jun 2021 14:00:43 -0400 Subject: [PATCH 27/31] fixed up jinja2 templating and documentation --- awx_collection/TESTING.md | 17 +++++++++-------- .../tools/roles/generate/templates/module.j2 | 14 +++++++------- .../template_galaxy/templates/README.md.j2 | 4 +++- awx_collection/tools/vars/associations.yml | 3 +++ awx_collection/tools/vars/examples.yml | 10 +++++----- awx_collection/tools/vars/resolution.yml | 11 +++++++++-- 6 files changed, 36 insertions(+), 23 deletions(-) diff --git a/awx_collection/TESTING.md b/awx_collection/TESTING.md index 0ecf99c26e..97ada687fb 100644 --- a/awx_collection/TESTING.md +++ b/awx_collection/TESTING.md @@ -12,7 +12,8 @@ The unit tests are stored in the `test/awx` directory and, where possible, test Let's take a closer look at the `test_token.py` file (which tests the `token` module): ``` -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function + __metaclass__ = type import pytest @@ -27,12 +28,12 @@ def test_create_token(run_module, admin_user): 'description': 'barfoo', 'state': 'present', 'scope': 'read', - 'tower_host': None, - 'tower_username': None, - 'tower_password': None, + 'controller_host': None, + 'controller_username': None, + 'controller_password': None, 'validate_certs': None, - 'tower_oauthtoken': None, - 'tower_config_file': None, + 'controller_oauthtoken': None, + 'controller_config_file': None, } result = run_module('token', module_args, admin_user) @@ -97,7 +98,7 @@ While not strictly followed, the general flow of a test should be: ``` - name: Try to use a token as a dict which is missing the token parameter job_list: - tower_oauthtoken: + controller_oauthtoken: not_token: "This has no token entry" register: results ignore_errors: true @@ -105,7 +106,7 @@ While not strictly followed, the general flow of a test should be: - assert: that: - results is failed - - '"The provided dict in tower_oauthtoken did not properly contain the token entry" == results.msg' + - '"The provided dict in controller_oauthtoken did not properly contain the token entry" == results.msg' ``` - **`Block:`** diff --git a/awx_collection/tools/roles/generate/templates/module.j2 b/awx_collection/tools/roles/generate/templates/module.j2 index 407cbd8530..57e6bc4c77 100644 --- a/awx_collection/tools/roles/generate/templates/module.j2 +++ b/awx_collection/tools/roles/generate/templates/module.j2 @@ -22,12 +22,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', DOCUMENTATION = ''' --- -module: tower_{{ singular_item_type }} +module: {{ singular_item_type }} author: "John Westcott IV (@john-westcott-iv)" version_added: "4.0.0" -short_description: create, update, or destroy Ansible Tower {{ human_readable }}. +short_description: create, update, or destroy Automation Platform Controller {{ human_readable }}. description: - - Create, update, or destroy Ansible Tower {{ human_readable }}. See + - Create, update, or destroy Automation Platform Controller {{ human_readable }}. See U(https://www.ansible.com/tower) for an overview. options: {% for option in item['json']['actions']['POST'] %} @@ -37,12 +37,12 @@ options: {% if 'help_text' in item['json']['actions']['POST'][option] %} - {{ item['json']['actions']['POST'][option]['help_text'] }} {% else %} - - NO DESCRIPTION GIVEN IN THE TOWER API + - NO DESCRIPTION GIVEN IN THE API {% endif %} required: {{ item['json']['actions']['POST'][option]['required'] }} type: {{ type_map[ item['json']['actions']['POST'][option]['type'] ] }} {% if 'default' in item['json']['actions']['POST'][option] %} -{# for tower_job_template/extra vars, its type is dict but its default is '', so we want to make that {} #} +{# for job_template/extra vars, its type is dict but its default is '', so we want to make that {} #} {% if item['json']['actions']['POST'][option]['default'] == '' and type_map[ item['json']['actions']['POST'][option]['type'] ] == 'dict' %} default: {} {% else %} @@ -82,9 +82,9 @@ options: choices: ["present", "absent"] default: "present" type: str - tower_oauthtoken: + controller_oauthtoken: description: - - The Tower OAuth token to use. + - The OAuth token to use. required: False type: str extends_documentation_fragment: awx.awx.auth diff --git a/awx_collection/tools/roles/template_galaxy/templates/README.md.j2 b/awx_collection/tools/roles/template_galaxy/templates/README.md.j2 index 274df392b5..88fd3c4739 100644 --- a/awx_collection/tools/roles/template_galaxy/templates/README.md.j2 +++ b/awx_collection/tools/roles/template_galaxy/templates/README.md.j2 @@ -76,11 +76,13 @@ Notable releases of the `{{ collection_namespace }}.{{ collection_package }}` co - 0.0.1-devel is the version you should see if installing from source, which is intended for development and expected to be unstable. {% else %} - 3.7.0 initial release + - 4.0.0 ansible.tower renamed to ansible.controller + - tower_ prefix is dropped from the module names, e.g. tower_inventory becomes inventory {% endif %} The following notes are changes that may require changes to playbooks: - - The module tower_notification was renamed tower_notification_template. In ansible >= 2.10 there is a seemless redirect. Ansible 2.9 does not respect the redirect. + - The module tower_notification was renamed tower_notification_template. In ansible >= 2.10 there is a seamless redirect. Ansible 2.9 does not respect the redirect. - When a project is created, it will wait for the update/sync to finish by default; this can be turned off with the `wait` parameter, if desired. - Creating a "scan" type job template is no longer supported. - Specifying a custom certificate via the `TOWER_CERTIFICATE` environment variable no longer works. diff --git a/awx_collection/tools/vars/associations.yml b/awx_collection/tools/vars/associations.yml index 9d95bd666e..467d83ec27 100644 --- a/awx_collection/tools/vars/associations.yml +++ b/awx_collection/tools/vars/associations.yml @@ -4,10 +4,13 @@ associations: - related_item: credentials endpoint: credentials description: "The credentials used by this job template" + required: False groups: - related_item: hosts endpoint: hosts description: "The hosts associated with this group" + required: False - related_item: groups endpoint: children description: "The hosts associated with this group" + required: False diff --git a/awx_collection/tools/vars/examples.yml b/awx_collection/tools/vars/examples.yml index 95fe4a3f53..f3c612f60e 100644 --- a/awx_collection/tools/vars/examples.yml +++ b/awx_collection/tools/vars/examples.yml @@ -9,7 +9,7 @@ examples: first_name: John last_name: Doe state: present - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" - name: Add user as a system administrator user: @@ -18,7 +18,7 @@ examples: email: jdoe@example.org superuser: yes state: present - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" - name: Add user as a system auditor user: @@ -27,14 +27,14 @@ examples: email: jdoe@example.org auditor: yes state: present - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" - name: Delete user user: username: jdoe email: jdoe@example.org state: absent - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" job_templates: | - name: Create Ping job template @@ -46,6 +46,6 @@ examples: playbook: "ping.yml" credential: "Local" state: "present" - tower_config_file: "~/tower_cli.cfg" + controller_config_file: "~/tower_cli.cfg" survey_enabled: yes survey_spec: "{{ '{{' }} lookup('file', 'my_survey.json') {{ '}}' }}" diff --git a/awx_collection/tools/vars/resolution.yml b/awx_collection/tools/vars/resolution.yml index 2beda0ff23..de946a6cf2 100644 --- a/awx_collection/tools/vars/resolution.yml +++ b/awx_collection/tools/vars/resolution.yml @@ -1,7 +1,14 @@ --- name_to_id_endpoint_resolution: webhook_credential: credentials - project: projects + credential: credentials + credential_type: credential_types + default_environment: execution_environments + execution_environment: execution_environments inventory: inventories organization: organizations - credential: credentials + project: projects + source_project: projects + team: teams + unified_job_template: unified_job_templates + user: users From c9e7747f2d05aaf0c3cd66303a6f40961f57c42e Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Mon, 7 Jun 2021 15:29:05 -0400 Subject: [PATCH 28/31] black ignore awx_collection --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 3496e7ac91..3dbfd016a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,3 +2,4 @@ line-length = 160 fast = true skip-string-normalization = true +exclude = "awx_collection" From 44c50bbbf7e5a62157f89a37e805bcc67dd43fd1 Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Mon, 7 Jun 2021 23:32:45 -0400 Subject: [PATCH 29/31] add redirect for lookup and inventory plugins --- awx_collection/meta/runtime.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/awx_collection/meta/runtime.yml b/awx_collection/meta/runtime.yml index 430d7dad74..8de7f229c6 100644 --- a/awx_collection/meta/runtime.yml +++ b/awx_collection/meta/runtime.yml @@ -32,11 +32,17 @@ plugin_routing: inventory: tower: redirect: awx.awx.controller + awx.awx.tower: + redirect: awx.awx.controller lookup: tower_api: redirect: awx.awx.controller_api tower_schedule_rrule: redirect: awx.awx.schedule_rrule + awx.awx.tower_api: + redirect: awx.awx.controller_api + awx.awx.tower_schedule_rrule: + redirect: awx.awx.tower_schedule_rrule modules: # if playbook does not specify a FQCN tower_ad_hoc_command_cancel: From 1deaf55ba42c648aebc21417201544f8284d1740 Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Tue, 8 Jun 2021 10:22:33 -0400 Subject: [PATCH 30/31] syntax error in runtime.yml --- awx_collection/meta/runtime.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/awx_collection/meta/runtime.yml b/awx_collection/meta/runtime.yml index 8de7f229c6..4dfa5cb4f2 100644 --- a/awx_collection/meta/runtime.yml +++ b/awx_collection/meta/runtime.yml @@ -27,7 +27,6 @@ action_groups: - workflow_job_template_node - workflow_job_template - workflow_launch - plugin_routing: inventory: tower: @@ -39,8 +38,8 @@ plugin_routing: redirect: awx.awx.controller_api tower_schedule_rrule: redirect: awx.awx.schedule_rrule - awx.awx.tower_api: - redirect: awx.awx.controller_api + awx.awx.tower_api: + redirect: awx.awx.controller_api awx.awx.tower_schedule_rrule: redirect: awx.awx.tower_schedule_rrule modules: From 9eda6359f07d4fb65aea94387844509cd0655319 Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Tue, 8 Jun 2021 10:49:41 -0400 Subject: [PATCH 31/31] False to false to fix linter --- awx_collection/tools/vars/associations.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/awx_collection/tools/vars/associations.yml b/awx_collection/tools/vars/associations.yml index 467d83ec27..6f710db3b9 100644 --- a/awx_collection/tools/vars/associations.yml +++ b/awx_collection/tools/vars/associations.yml @@ -4,13 +4,13 @@ associations: - related_item: credentials endpoint: credentials description: "The credentials used by this job template" - required: False + required: false groups: - related_item: hosts endpoint: hosts description: "The hosts associated with this group" - required: False + required: false - related_item: groups endpoint: children description: "The hosts associated with this group" - required: False + required: false