mirror of
https://github.com/ansible/awx.git
synced 2026-02-18 03:30:02 -03:30
@@ -269,7 +269,7 @@ EXAMPLES = '''
|
||||
|
||||
'''
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
|
||||
KIND_CHOICES = {
|
||||
'ssh': 'Machine',
|
||||
@@ -336,7 +336,7 @@ def main():
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(argument_spec=argument_spec, required_one_of=[['kind', 'credential_type']])
|
||||
module = TowerAPIModule(argument_spec=argument_spec, required_one_of=[['kind', 'credential_type']])
|
||||
|
||||
# Extract our parameters
|
||||
name = module.params.get('name')
|
||||
|
||||
@@ -70,7 +70,7 @@ EXAMPLES = '''
|
||||
|
||||
'''
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
|
||||
|
||||
def main():
|
||||
@@ -85,7 +85,7 @@ def main():
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(argument_spec=argument_spec)
|
||||
module = TowerAPIModule(argument_spec=argument_spec)
|
||||
|
||||
# Extract our parameters
|
||||
description = module.params.get('description')
|
||||
|
||||
@@ -81,7 +81,7 @@ EXAMPLES = '''
|
||||
RETURN = ''' # '''
|
||||
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
|
||||
KIND_CHOICES = {
|
||||
'ssh': 'Machine',
|
||||
@@ -105,7 +105,7 @@ def main():
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(argument_spec=argument_spec)
|
||||
module = TowerAPIModule(argument_spec=argument_spec)
|
||||
|
||||
# Extract our parameters
|
||||
name = module.params.get('name')
|
||||
|
||||
166
awx_collection/plugins/modules/tower_export.py
Normal file
166
awx_collection/plugins/modules/tower_export.py
Normal file
@@ -0,0 +1,166 @@
|
||||
#!/usr/bin/python
|
||||
# coding: utf-8 -*-
|
||||
|
||||
# (c) 2017, John Westcott IV <john.westcott.iv@redhat.com>
|
||||
# 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': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: tower_export
|
||||
author: "John Westcott IV (@john-westcott-iv)"
|
||||
version_added: "3.7"
|
||||
short_description: export resources from Ansible Tower.
|
||||
description:
|
||||
- Export assets from Ansible Tower.
|
||||
options:
|
||||
all:
|
||||
description:
|
||||
- Export all assets
|
||||
type: bool
|
||||
default: 'False'
|
||||
organizations:
|
||||
description:
|
||||
- organization name to export
|
||||
type: str
|
||||
users:
|
||||
description:
|
||||
- user name to export
|
||||
type: str
|
||||
teams:
|
||||
description:
|
||||
- team name to export
|
||||
type: str
|
||||
credential_types:
|
||||
description:
|
||||
- credential type name to export
|
||||
type: str
|
||||
credentials:
|
||||
description:
|
||||
- credential name to export
|
||||
type: str
|
||||
notification_templates:
|
||||
description:
|
||||
- notification template name to export
|
||||
type: str
|
||||
inventory_sources:
|
||||
description:
|
||||
- inventory soruce to export
|
||||
type: str
|
||||
inventory:
|
||||
description:
|
||||
- inventory name to export
|
||||
type: str
|
||||
projects:
|
||||
description:
|
||||
- project name to export
|
||||
type: str
|
||||
job_templates:
|
||||
description:
|
||||
- job template name to export
|
||||
type: str
|
||||
workflow_job_templates:
|
||||
description:
|
||||
- workflow name to export
|
||||
type: str
|
||||
requirements:
|
||||
- "awxkit >= 9.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
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Export all tower assets
|
||||
tower_export:
|
||||
all: True
|
||||
- name: Export all inventories
|
||||
tower_export:
|
||||
inventory: 'all'
|
||||
- name: Export a job template named "My Template" and all Credentials
|
||||
tower_export:
|
||||
job_template: "My Template"
|
||||
credential: 'all'
|
||||
'''
|
||||
|
||||
from os import environ
|
||||
import logging
|
||||
from ansible.module_utils.six.moves import StringIO
|
||||
from ..module_utils.tower_awxkit import TowerAWXKitModule
|
||||
|
||||
try:
|
||||
from awxkit.api.pages.api import EXPORTABLE_RESOURCES
|
||||
HAS_EXPORTABLE_RESOURCES = True
|
||||
except ImportError:
|
||||
HAS_EXPORTABLE_RESOURCES = False
|
||||
|
||||
|
||||
def main():
|
||||
argument_spec = dict(
|
||||
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
|
||||
if HAS_EXPORTABLE_RESOURCES:
|
||||
for resource in EXPORTABLE_RESOURCES:
|
||||
argument_spec[resource] = dict(type='str')
|
||||
|
||||
module = TowerAWXKitModule(argument_spec=argument_spec)
|
||||
|
||||
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
|
||||
module.json_output['changed'] = False
|
||||
|
||||
# The exporter code currently works like the following:
|
||||
# Empty string == all assets of that type
|
||||
# Non-Empty string = just one asset of that type (by name or ID)
|
||||
# Asset type not present or None = skip asset type (unless everything is None, then export all)
|
||||
# Here we are going to setup a dict of values to export
|
||||
export_args = {}
|
||||
for resource in EXPORTABLE_RESOURCES:
|
||||
if module.params.get('all') or module.params.get(resource) == 'all':
|
||||
# If we are exporting everything or we got the keyword "all" we pass in an empty string for this asset type
|
||||
export_args[resource] = ''
|
||||
else:
|
||||
# Otherwise we take either the string or None (if the parameter was not passed) to get one or no items
|
||||
export_args[resource] = module.params.get(resource)
|
||||
|
||||
# Currently the import process does not return anything on error
|
||||
# It simply just logs to pythons logger
|
||||
# Setup a log gobbler to get error messages from import_assets
|
||||
log_capture_string = StringIO()
|
||||
ch = logging.StreamHandler(log_capture_string)
|
||||
for logger_name in ['awxkit.api.pages.api', 'awxkit.api.pages.page']:
|
||||
logger = logging.getLogger(logger_name)
|
||||
logger.setLevel(logging.WARNING)
|
||||
ch.setLevel(logging.WARNING)
|
||||
|
||||
logger.addHandler(ch)
|
||||
log_contents = ''
|
||||
|
||||
# Run the import process
|
||||
try:
|
||||
module.json_output['assets'] = module.get_api_v2_object().export_assets(**export_args)
|
||||
module.exit_json(**module.json_output)
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Failed to export assets {0}".format(e))
|
||||
finally:
|
||||
# Finally consume the logs incase there were any errors and die if there were
|
||||
log_contents = log_capture_string.getvalue()
|
||||
log_capture_string.close()
|
||||
if log_contents != '':
|
||||
module.fail_json(msg=log_contents)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -76,7 +76,7 @@ EXAMPLES = '''
|
||||
tower_config_file: "~/tower_cli.cfg"
|
||||
'''
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
import json
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ def main():
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(argument_spec=argument_spec)
|
||||
module = TowerAPIModule(argument_spec=argument_spec)
|
||||
|
||||
# Extract our parameters
|
||||
name = module.params.get('name')
|
||||
|
||||
@@ -72,7 +72,7 @@ EXAMPLES = '''
|
||||
'''
|
||||
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
import json
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ def main():
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(argument_spec=argument_spec)
|
||||
module = TowerAPIModule(argument_spec=argument_spec)
|
||||
|
||||
# Extract our parameters
|
||||
name = module.params.get('name')
|
||||
|
||||
105
awx_collection/plugins/modules/tower_import.py
Normal file
105
awx_collection/plugins/modules/tower_import.py
Normal file
@@ -0,0 +1,105 @@
|
||||
#!/usr/bin/python
|
||||
# coding: utf-8 -*-
|
||||
|
||||
# (c) 2017, John Westcott IV <john.westcott.iv@redhat.com>
|
||||
# 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': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: tower_import
|
||||
author: "John Westcott (@john-westcott-iv)"
|
||||
version_added: "3.7"
|
||||
short_description: import resources into Ansible Tower.
|
||||
description:
|
||||
- Import assets into Ansible Tower. 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
|
||||
required: True
|
||||
type: dict
|
||||
requirements:
|
||||
- "awxkit >= 9.3.0"
|
||||
extends_documentation_fragment: awx.awx.auth
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Export all assets
|
||||
tower_export:
|
||||
all: True
|
||||
registeR: export_output
|
||||
|
||||
- name: Import all tower assets from our export
|
||||
tower_import:
|
||||
assets: "{{ export_output.assets }}"
|
||||
|
||||
- name: Load data from a json file created by a command like awx export --organization Default
|
||||
tower_import:
|
||||
assets: "{{ lookup('file', 'org.json') | from_json() }}"
|
||||
'''
|
||||
|
||||
from ..module_utils.tower_awxkit import TowerAWXKitModule
|
||||
|
||||
# These two lines are not needed if awxkit changes to do progamatic notifications on issues
|
||||
from ansible.module_utils.six.moves import StringIO
|
||||
import logging
|
||||
|
||||
# In this module we don't use EXPORTABLE_RESOURCES, we just want to validate that our installed awxkit has import/export
|
||||
try:
|
||||
from awxkit.api.pages.api import EXPORTABLE_RESOURCES
|
||||
HAS_EXPORTABLE_RESOURCES = True
|
||||
except ImportError:
|
||||
HAS_EXPORTABLE_RESOURCES = False
|
||||
|
||||
|
||||
def main():
|
||||
argument_spec = dict(
|
||||
assets=dict(type='dict', required=True)
|
||||
)
|
||||
|
||||
module = TowerAWXKitModule(argument_spec=argument_spec, supports_check_mode=False)
|
||||
|
||||
assets = module.params.get('assets')
|
||||
|
||||
if not HAS_EXPORTABLE_RESOURCES:
|
||||
module.fail_json(msg="Your version of awxkit does not appear to have import/export")
|
||||
|
||||
# Currently the import process does not return anything on error
|
||||
# It simply just logs to pythons logger
|
||||
# Setup a log gobbler to get error messages from import_assets
|
||||
logger = logging.getLogger('awxkit.api.pages.api')
|
||||
logger.setLevel(logging.WARNING)
|
||||
log_capture_string = StringIO()
|
||||
ch = logging.StreamHandler(log_capture_string)
|
||||
ch.setLevel(logging.WARNING)
|
||||
logger.addHandler(ch)
|
||||
log_contents = ''
|
||||
|
||||
# Run the import process
|
||||
try:
|
||||
module.json_output['changed'] = module.get_api_v2_object().import_assets(assets)
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Failed to import assets {0}".format(e))
|
||||
finally:
|
||||
# Finally consume the logs incase there were any errors and die if there were
|
||||
log_contents = log_capture_string.getvalue()
|
||||
log_capture_string.close()
|
||||
if log_contents != '':
|
||||
module.fail_json(msg=log_contents)
|
||||
|
||||
module.exit_json(**module.json_output)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -48,7 +48,11 @@ options:
|
||||
type: str
|
||||
host_filter:
|
||||
description:
|
||||
- The host_filter field. Only useful when C(kind=smart).
|
||||
- The host_filter field. Only useful when C(kind=smart).
|
||||
type: str
|
||||
insights_credential:
|
||||
description:
|
||||
- Credentials to be used by hosts belonging to this inventory when accessing Red Hat Insights API.
|
||||
type: str
|
||||
state:
|
||||
description:
|
||||
@@ -71,7 +75,7 @@ EXAMPLES = '''
|
||||
'''
|
||||
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
import json
|
||||
|
||||
|
||||
@@ -84,11 +88,12 @@ def main():
|
||||
variables=dict(type='dict'),
|
||||
kind=dict(choices=['', 'smart'], default=''),
|
||||
host_filter=dict(),
|
||||
insights_credential=dict(),
|
||||
state=dict(choices=['present', 'absent'], default='present'),
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(argument_spec=argument_spec)
|
||||
module = TowerAPIModule(argument_spec=argument_spec)
|
||||
|
||||
# Extract our parameters
|
||||
name = module.params.get('name')
|
||||
@@ -98,6 +103,7 @@ def main():
|
||||
state = module.params.get('state')
|
||||
kind = module.params.get('kind')
|
||||
host_filter = module.params.get('host_filter')
|
||||
insights_credential = module.params.get('insights_credential')
|
||||
|
||||
# Attempt to look up the related items the user specified (these will fail the module if not found)
|
||||
org_id = module.resolve_name_to_id('organizations', organization)
|
||||
@@ -125,6 +131,8 @@ def main():
|
||||
inventory_fields['description'] = description
|
||||
if variables is not None:
|
||||
inventory_fields['variables'] = json.dumps(variables)
|
||||
if insights_credential is not None:
|
||||
inventory_fields['insights_credential'] = module.resolve_name_to_id('credentials', insights_credential)
|
||||
|
||||
# We need to perform a check to make sure you are not trying to convert a regular inventory into a smart one.
|
||||
if inventory and inventory['kind'] == '' and inventory_fields['kind'] == 'smart':
|
||||
|
||||
@@ -57,22 +57,22 @@ options:
|
||||
description:
|
||||
- The variables or environment fields to apply to this source type.
|
||||
type: dict
|
||||
enabled_var:
|
||||
description:
|
||||
- The variable to use to determine enabled state e.g., "status.power_state"
|
||||
type: str
|
||||
enabled_value:
|
||||
description:
|
||||
- Value when the host is considered enabled, e.g., "powered_on"
|
||||
type: str
|
||||
host_filter:
|
||||
description:
|
||||
- If specified, AWX will only import hosts that match this regular expression.
|
||||
type: str
|
||||
credential:
|
||||
description:
|
||||
- Credential to use for the source.
|
||||
type: str
|
||||
source_regions:
|
||||
description:
|
||||
- Regions for cloud provider.
|
||||
type: str
|
||||
instance_filters:
|
||||
description:
|
||||
- Comma-separated list of filter expressions for matching hosts.
|
||||
type: str
|
||||
group_by:
|
||||
description:
|
||||
- Limit groups automatically created from inventory source.
|
||||
type: str
|
||||
overwrite:
|
||||
description:
|
||||
- Delete child groups and hosts not found in source.
|
||||
@@ -144,7 +144,7 @@ EXAMPLES = '''
|
||||
private: false
|
||||
'''
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
from json import dumps
|
||||
|
||||
|
||||
@@ -164,10 +164,10 @@ def main():
|
||||
source_path=dict(),
|
||||
source_script=dict(),
|
||||
source_vars=dict(type='dict'),
|
||||
enabled_var=dict(),
|
||||
enabled_value=dict(),
|
||||
host_filter=dict(),
|
||||
credential=dict(),
|
||||
source_regions=dict(),
|
||||
instance_filters=dict(),
|
||||
group_by=dict(),
|
||||
overwrite=dict(type='bool'),
|
||||
overwrite_vars=dict(type='bool'),
|
||||
custom_virtualenv=dict(),
|
||||
@@ -184,7 +184,7 @@ def main():
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(argument_spec=argument_spec)
|
||||
module = TowerAPIModule(argument_spec=argument_spec)
|
||||
|
||||
# Extract our parameters
|
||||
name = module.params.get('name')
|
||||
@@ -245,10 +245,9 @@ def main():
|
||||
|
||||
OPTIONAL_VARS = (
|
||||
'description', 'source', 'source_path', 'source_vars',
|
||||
'source_regions', 'instance_filters', 'group_by',
|
||||
'overwrite', 'overwrite_vars', 'custom_virtualenv',
|
||||
'timeout', 'verbosity', 'update_on_launch', 'update_cache_timeout',
|
||||
'update_on_project_update'
|
||||
'update_on_project_update', 'enabled_var', 'enabled_value', 'host_filter',
|
||||
)
|
||||
|
||||
# Layer in all remaining optional information
|
||||
|
||||
@@ -50,7 +50,7 @@ id:
|
||||
'''
|
||||
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
|
||||
|
||||
def main():
|
||||
@@ -61,7 +61,7 @@ def main():
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(argument_spec=argument_spec)
|
||||
module = TowerAPIModule(argument_spec=argument_spec)
|
||||
|
||||
# Extract our parameters
|
||||
job_id = module.params.get('job_id')
|
||||
|
||||
@@ -81,6 +81,22 @@ options:
|
||||
description:
|
||||
- Passwords for credentials which are set to prompt on launch
|
||||
type: dict
|
||||
wait:
|
||||
description:
|
||||
- Wait for the job to complete.
|
||||
default: False
|
||||
type: bool
|
||||
interval:
|
||||
description:
|
||||
- The interval to request an update from Tower.
|
||||
required: False
|
||||
default: 1
|
||||
type: float
|
||||
timeout:
|
||||
description:
|
||||
- If waiting for the job to complete this will abort after this
|
||||
amount of seconds
|
||||
type: int
|
||||
extends_documentation_fragment: awx.awx.auth
|
||||
'''
|
||||
|
||||
@@ -124,7 +140,7 @@ status:
|
||||
sample: pending
|
||||
'''
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
|
||||
|
||||
def main():
|
||||
@@ -143,10 +159,13 @@ def main():
|
||||
verbosity=dict(type='int', choices=[0, 1, 2, 3, 4, 5]),
|
||||
diff_mode=dict(type='bool'),
|
||||
credential_passwords=dict(type='dict'),
|
||||
wait=dict(default=False, type='bool'),
|
||||
interval=dict(default=1.0, type='float'),
|
||||
timeout=dict(default=None, type='int'),
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(argument_spec=argument_spec)
|
||||
module = TowerAPIModule(argument_spec=argument_spec)
|
||||
|
||||
optional_args = {}
|
||||
# Extract our parameters
|
||||
@@ -162,6 +181,9 @@ def main():
|
||||
optional_args['verbosity'] = module.params.get('verbosity')
|
||||
optional_args['diff_mode'] = module.params.get('diff_mode')
|
||||
optional_args['credential_passwords'] = module.params.get('credential_passwords')
|
||||
wait = module.params.get('wait')
|
||||
interval = module.params.get('interval')
|
||||
timeout = module.params.get('timeout')
|
||||
|
||||
# Create a datastructure to pass into our job launch
|
||||
post_data = {}
|
||||
@@ -216,6 +238,21 @@ def main():
|
||||
if results['status_code'] != 201:
|
||||
module.fail_json(msg="Failed to launch job, see response for details", **{'response': results})
|
||||
|
||||
if not wait:
|
||||
module.exit_json(**{
|
||||
'changed': True,
|
||||
'id': results['json']['id'],
|
||||
'status': results['json']['status'],
|
||||
})
|
||||
|
||||
# Invoke wait function
|
||||
results = module.wait_on_url(
|
||||
url=results['json']['url'],
|
||||
object_name=name,
|
||||
object_type='Job',
|
||||
timeout=timeout, interval=interval
|
||||
)
|
||||
|
||||
module.exit_json(**{
|
||||
'changed': True,
|
||||
'id': results['json']['id'],
|
||||
|
||||
@@ -80,7 +80,7 @@ results:
|
||||
'''
|
||||
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
|
||||
|
||||
def main():
|
||||
@@ -93,7 +93,7 @@ def main():
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(
|
||||
module = TowerAPIModule(
|
||||
argument_spec=argument_spec,
|
||||
mutually_exclusive=[
|
||||
('page', 'all_pages'),
|
||||
|
||||
@@ -317,7 +317,7 @@ EXAMPLES = '''
|
||||
|
||||
'''
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
import json
|
||||
|
||||
|
||||
@@ -388,7 +388,7 @@ def main():
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(argument_spec=argument_spec)
|
||||
module = TowerAPIModule(argument_spec=argument_spec)
|
||||
|
||||
# Extract our parameters
|
||||
name = module.params.get('name')
|
||||
|
||||
@@ -55,7 +55,7 @@ EXAMPLES = '''
|
||||
- name: Launch a job
|
||||
tower_job_launch:
|
||||
job_template: "My Job Template"
|
||||
register: job
|
||||
register: job
|
||||
|
||||
- name: Wait for job max 120s
|
||||
tower_job_wait:
|
||||
@@ -92,21 +92,7 @@ status:
|
||||
'''
|
||||
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
import time
|
||||
|
||||
|
||||
def check_job(module, job_url):
|
||||
response = module.get_endpoint(job_url)
|
||||
if response['status_code'] != 200:
|
||||
module.fail_json(msg="Unable to read job from Tower {0}: {1}".format(response['status_code'], module.extract_errors_from_response(response)))
|
||||
|
||||
# Since we were successful, extract the fields we want to return
|
||||
for k in ('id', 'status', 'elapsed', 'started', 'finished'):
|
||||
module.json_output[k] = response['json'].get(k)
|
||||
|
||||
# And finally return the payload
|
||||
return response['json']
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
|
||||
|
||||
def main():
|
||||
@@ -120,7 +106,7 @@ def main():
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(argument_spec=argument_spec)
|
||||
module = TowerAPIModule(argument_spec=argument_spec)
|
||||
|
||||
# Extract our parameters
|
||||
job_id = module.params.get('job_id')
|
||||
@@ -153,31 +139,13 @@ def main():
|
||||
if job is None:
|
||||
module.fail_json(msg='Unable to wait on job {0}; that ID does not exist in Tower.'.format(job_id))
|
||||
|
||||
job_url = job['url']
|
||||
|
||||
# Grab our start time to compare against for the timeout
|
||||
start = time.time()
|
||||
|
||||
# Get the initial job status from Tower, this will exit if there are any issues with the HTTP call
|
||||
result = check_job(module, job_url)
|
||||
|
||||
# Loop while the job is not yet completed
|
||||
while not result['finished']:
|
||||
# If we are past our time out fail with a message
|
||||
if timeout and timeout < time.time() - start:
|
||||
module.json_output['msg'] = "Monitoring aborted due to timeout"
|
||||
module.fail_json(**module.json_output)
|
||||
|
||||
# Put the process to sleep for our interval
|
||||
time.sleep(interval)
|
||||
|
||||
# Check the job again
|
||||
result = check_job(module, job_url)
|
||||
|
||||
# If the job has failed, we want to raise an Exception for that so we get a non-zero response.
|
||||
if result['failed']:
|
||||
module.json_output['msg'] = 'Job with id {0} failed'.format(job_id)
|
||||
module.fail_json(**module.json_output)
|
||||
# Invoke wait function
|
||||
result = module.wait_on_url(
|
||||
url=job['url'],
|
||||
object_name=job_id,
|
||||
object_type='legacy_job_wait',
|
||||
timeout=timeout, interval=interval
|
||||
)
|
||||
|
||||
module.exit_json(**module.json_output)
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ EXAMPLES = '''
|
||||
organization: My Organization
|
||||
'''
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
|
||||
|
||||
def main():
|
||||
@@ -67,7 +67,7 @@ def main():
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(argument_spec=argument_spec)
|
||||
module = TowerAPIModule(argument_spec=argument_spec)
|
||||
|
||||
# Extract our parameters
|
||||
name = module.params.get('name')
|
||||
|
||||
@@ -43,12 +43,12 @@ EXAMPLES = '''
|
||||
eula_accepted: True
|
||||
'''
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
module = TowerModule(
|
||||
module = TowerAPIModule(
|
||||
argument_spec=dict(
|
||||
data=dict(type='dict', required=True),
|
||||
eula_accepted=dict(type='bool', required=True),
|
||||
|
||||
@@ -62,11 +62,11 @@ EXAMPLES = '''
|
||||
'''
|
||||
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
|
||||
|
||||
def main():
|
||||
module = TowerModule(argument_spec={})
|
||||
module = TowerAPIModule(argument_spec={})
|
||||
namespace = {
|
||||
'awx': 'awx',
|
||||
'tower': 'ansible'
|
||||
|
||||
@@ -15,7 +15,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: tower_notification
|
||||
module: tower_notification_template
|
||||
author: "Samuel Carpentier (@samcarpentier)"
|
||||
short_description: create, update, or destroy Ansible Tower notification.
|
||||
description:
|
||||
@@ -203,7 +203,7 @@ extends_documentation_fragment: awx.awx.auth
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Add Slack notification with custom messages
|
||||
tower_notification:
|
||||
tower_notification_template:
|
||||
name: slack notification
|
||||
organization: Default
|
||||
notification_type: slack
|
||||
@@ -222,7 +222,7 @@ EXAMPLES = '''
|
||||
tower_config_file: "~/tower_cli.cfg"
|
||||
|
||||
- name: Add webhook notification
|
||||
tower_notification:
|
||||
tower_notification_template:
|
||||
name: webhook notification
|
||||
notification_type: webhook
|
||||
notification_configuration:
|
||||
@@ -233,7 +233,7 @@ EXAMPLES = '''
|
||||
tower_config_file: "~/tower_cli.cfg"
|
||||
|
||||
- name: Add email notification
|
||||
tower_notification:
|
||||
tower_notification_template:
|
||||
name: email notification
|
||||
notification_type: email
|
||||
notification_configuration:
|
||||
@@ -250,7 +250,7 @@ EXAMPLES = '''
|
||||
tower_config_file: "~/tower_cli.cfg"
|
||||
|
||||
- name: Add twilio notification
|
||||
tower_notification:
|
||||
tower_notification_template:
|
||||
name: twilio notification
|
||||
notification_type: twilio
|
||||
notification_configuration:
|
||||
@@ -263,7 +263,7 @@ EXAMPLES = '''
|
||||
tower_config_file: "~/tower_cli.cfg"
|
||||
|
||||
- name: Add PagerDuty notification
|
||||
tower_notification:
|
||||
tower_notification_template:
|
||||
name: pagerduty notification
|
||||
notification_type: pagerduty
|
||||
notification_configuration:
|
||||
@@ -275,7 +275,7 @@ EXAMPLES = '''
|
||||
tower_config_file: "~/tower_cli.cfg"
|
||||
|
||||
- name: Add IRC notification
|
||||
tower_notification:
|
||||
tower_notification_template:
|
||||
name: irc notification
|
||||
notification_type: irc
|
||||
notification_configuration:
|
||||
@@ -290,7 +290,7 @@ EXAMPLES = '''
|
||||
tower_config_file: "~/tower_cli.cfg"
|
||||
|
||||
- name: Delete notification
|
||||
tower_notification:
|
||||
tower_notification_template:
|
||||
name: old notification
|
||||
state: absent
|
||||
tower_config_file: "~/tower_cli.cfg"
|
||||
@@ -300,7 +300,7 @@ EXAMPLES = '''
|
||||
RETURN = ''' # '''
|
||||
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
|
||||
OLD_INPUT_NAMES = (
|
||||
'username', 'sender', 'recipients', 'use_tls',
|
||||
@@ -355,7 +355,7 @@ def main():
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(argument_spec=argument_spec)
|
||||
module = TowerAPIModule(argument_spec=argument_spec)
|
||||
|
||||
# Extract our parameters
|
||||
name = module.params.get('name')
|
||||
@@ -88,7 +88,7 @@ EXAMPLES = '''
|
||||
tower_config_file: "~/tower_cli.cfg"
|
||||
'''
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
|
||||
|
||||
def main():
|
||||
@@ -106,7 +106,7 @@ def main():
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(argument_spec=argument_spec)
|
||||
module = TowerAPIModule(argument_spec=argument_spec)
|
||||
|
||||
# Extract our parameters
|
||||
name = module.params.get('name')
|
||||
|
||||
@@ -55,10 +55,12 @@ options:
|
||||
- The refspec to use for the SCM resource.
|
||||
type: str
|
||||
default: ''
|
||||
scm_credential:
|
||||
credential:
|
||||
description:
|
||||
- Name of the credential to use with this SCM resource.
|
||||
type: str
|
||||
aliases:
|
||||
- scm_credential
|
||||
scm_clean:
|
||||
description:
|
||||
- Remove local modifications before updating.
|
||||
@@ -86,11 +88,13 @@ options:
|
||||
type: bool
|
||||
aliases:
|
||||
- scm_allow_override
|
||||
job_timeout:
|
||||
timeout:
|
||||
description:
|
||||
- The amount of time (in seconds) to run before the SCM Update is canceled. A value of 0 means no timeout.
|
||||
default: 0
|
||||
type: int
|
||||
aliases:
|
||||
- job_timeout
|
||||
custom_virtualenv:
|
||||
description:
|
||||
- Local absolute file path containing a custom Python virtualenv to use
|
||||
@@ -157,7 +161,7 @@ EXAMPLES = '''
|
||||
|
||||
import time
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
|
||||
|
||||
def wait_for_project_update(module, last_request):
|
||||
@@ -188,13 +192,13 @@ def main():
|
||||
local_path=dict(),
|
||||
scm_branch=dict(default=''),
|
||||
scm_refspec=dict(default=''),
|
||||
scm_credential=dict(),
|
||||
credential=dict(aliases=['scm_credential']),
|
||||
scm_clean=dict(type='bool', default=False),
|
||||
scm_delete_on_update=dict(type='bool', default=False),
|
||||
scm_update_on_launch=dict(type='bool', default=False),
|
||||
scm_update_cache_timeout=dict(type='int', default=0),
|
||||
allow_override=dict(type='bool', aliases=['scm_allow_override']),
|
||||
job_timeout=dict(type='int', default=0),
|
||||
timeout=dict(type='int', default=0, aliases=['job_timeout']),
|
||||
custom_virtualenv=dict(),
|
||||
organization=dict(required=True),
|
||||
notification_templates_started=dict(type="list", elements='str'),
|
||||
@@ -205,7 +209,7 @@ def main():
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(argument_spec=argument_spec)
|
||||
module = TowerAPIModule(argument_spec=argument_spec)
|
||||
|
||||
# Extract our parameters
|
||||
name = module.params.get('name')
|
||||
@@ -217,13 +221,13 @@ def main():
|
||||
local_path = module.params.get('local_path')
|
||||
scm_branch = module.params.get('scm_branch')
|
||||
scm_refspec = module.params.get('scm_refspec')
|
||||
scm_credential = module.params.get('scm_credential')
|
||||
credential = module.params.get('credential')
|
||||
scm_clean = module.params.get('scm_clean')
|
||||
scm_delete_on_update = module.params.get('scm_delete_on_update')
|
||||
scm_update_on_launch = module.params.get('scm_update_on_launch')
|
||||
scm_update_cache_timeout = module.params.get('scm_update_cache_timeout')
|
||||
allow_override = module.params.get('allow_override')
|
||||
job_timeout = module.params.get('job_timeout')
|
||||
timeout = module.params.get('timeout')
|
||||
custom_virtualenv = module.params.get('custom_virtualenv')
|
||||
organization = module.params.get('organization')
|
||||
state = module.params.get('state')
|
||||
@@ -231,8 +235,8 @@ def main():
|
||||
|
||||
# Attempt to look up the related items the user specified (these will fail the module if not found)
|
||||
org_id = module.resolve_name_to_id('organizations', organization)
|
||||
if scm_credential is not None:
|
||||
scm_credential_id = module.resolve_name_to_id('credentials', scm_credential)
|
||||
if credential is not None:
|
||||
credential = module.resolve_name_to_id('credentials', credential)
|
||||
|
||||
# Attempt to look up project based on the provided name and org ID
|
||||
project = module.get_one('projects', **{
|
||||
@@ -276,7 +280,7 @@ def main():
|
||||
'scm_refspec': scm_refspec,
|
||||
'scm_clean': scm_clean,
|
||||
'scm_delete_on_update': scm_delete_on_update,
|
||||
'timeout': job_timeout,
|
||||
'timeout': timeout,
|
||||
'organization': org_id,
|
||||
'scm_update_on_launch': scm_update_on_launch,
|
||||
'scm_update_cache_timeout': scm_update_cache_timeout,
|
||||
@@ -284,8 +288,8 @@ def main():
|
||||
}
|
||||
if description is not None:
|
||||
project_fields['description'] = description
|
||||
if scm_credential is not None:
|
||||
project_fields['credential'] = scm_credential_id
|
||||
if credential is not None:
|
||||
project_fields['credential'] = credential
|
||||
if allow_override is not None:
|
||||
project_fields['allow_override'] = allow_override
|
||||
if scm_type == '':
|
||||
|
||||
@@ -134,7 +134,7 @@ assets:
|
||||
sample: [ {}, {} ]
|
||||
'''
|
||||
|
||||
from ..module_utils.ansible_tower import TowerModule, tower_auth_config, HAS_TOWER_CLI
|
||||
from ..module_utils.tower_legacy import TowerLegacyModule, tower_auth_config, HAS_TOWER_CLI
|
||||
|
||||
try:
|
||||
from tower_cli.cli.transfer.receive import Receiver
|
||||
@@ -163,7 +163,7 @@ def main():
|
||||
workflow=dict(type='list', default=[], elements='str'),
|
||||
)
|
||||
|
||||
module = TowerModule(argument_spec=argument_spec, supports_check_mode=False)
|
||||
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")
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ EXAMPLES = '''
|
||||
state: present
|
||||
'''
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
|
||||
|
||||
def main():
|
||||
@@ -109,7 +109,7 @@ def main():
|
||||
state=dict(choices=['present', 'absent'], default='present'),
|
||||
)
|
||||
|
||||
module = TowerModule(argument_spec=argument_spec)
|
||||
module = TowerAPIModule(argument_spec=argument_spec)
|
||||
|
||||
role_type = module.params.pop('role')
|
||||
role_field = role_type + '_role'
|
||||
@@ -126,11 +126,10 @@ def main():
|
||||
resource_data = {}
|
||||
for param in resource_param_keys:
|
||||
endpoint = module.param_to_endpoint(param)
|
||||
name_field = 'username' if param == 'user' else 'name'
|
||||
|
||||
resource_name = params.get(param)
|
||||
if resource_name:
|
||||
resource = module.get_one(endpoint, **{'data': {name_field: resource_name}})
|
||||
resource = module.get_one_by_name_or_id(module.param_to_endpoint(param), resource_name)
|
||||
if not resource:
|
||||
module.fail_json(
|
||||
msg='Failed to update role, {0} not found in {1}'.format(param, endpoint),
|
||||
@@ -170,14 +169,14 @@ def main():
|
||||
if response['status_code'] == 204:
|
||||
module.json_output['changed'] = True
|
||||
else:
|
||||
module.fail_json(msg="Failed to grant role {0}".format(response['json']['detail']))
|
||||
module.fail_json(msg="Failed to grant role. {0}".format(response['json'].get('detail', response['json'].get('msg', 'unknown'))))
|
||||
else:
|
||||
for an_id in list(set(existing_associated_ids) & set(new_association_list)):
|
||||
response = module.post_endpoint(association_endpoint, **{'data': {'id': int(an_id), 'disassociate': True}})
|
||||
if response['status_code'] == 204:
|
||||
module.json_output['changed'] = True
|
||||
else:
|
||||
module.fail_json(msg="Failed to revoke role {0}".format(response['json']['detail']))
|
||||
module.fail_json(msg="Failed to revoke role. {0}".format(response['json'].get('detail', response['json'].get('msg', 'unknown'))))
|
||||
|
||||
module.exit_json(**module.json_output)
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ EXAMPLES = '''
|
||||
register: result
|
||||
'''
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
|
||||
|
||||
def main():
|
||||
@@ -161,7 +161,7 @@ def main():
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(argument_spec=argument_spec)
|
||||
module = TowerAPIModule(argument_spec=argument_spec)
|
||||
|
||||
# Extract our parameters
|
||||
rrule = module.params.get('rrule')
|
||||
|
||||
@@ -81,7 +81,7 @@ import os
|
||||
import sys
|
||||
|
||||
from ansible.module_utils.six.moves import StringIO
|
||||
from ..module_utils.ansible_tower import TowerModule, tower_auth_config, HAS_TOWER_CLI
|
||||
from ..module_utils.tower_legacy import TowerLegacyModule, tower_auth_config, HAS_TOWER_CLI
|
||||
|
||||
from tempfile import mkstemp
|
||||
|
||||
@@ -103,7 +103,7 @@ def main():
|
||||
password_management=dict(default='default', choices=['default', 'random']),
|
||||
)
|
||||
|
||||
module = TowerModule(argument_spec=argument_spec, supports_check_mode=False)
|
||||
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")
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ EXAMPLES = '''
|
||||
last_name: "surname"
|
||||
'''
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
|
||||
try:
|
||||
import yaml
|
||||
@@ -111,7 +111,7 @@ def main():
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(
|
||||
module = TowerAPIModule(
|
||||
argument_spec=argument_spec,
|
||||
required_one_of=[['name', 'settings']],
|
||||
mutually_exclusive=[['name', 'settings']],
|
||||
|
||||
@@ -60,7 +60,7 @@ EXAMPLES = '''
|
||||
tower_config_file: "~/tower_cli.cfg"
|
||||
'''
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
|
||||
|
||||
def main():
|
||||
@@ -74,7 +74,7 @@ def main():
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(argument_spec=argument_spec)
|
||||
module = TowerAPIModule(argument_spec=argument_spec)
|
||||
|
||||
# Extract our parameters
|
||||
name = module.params.get('name')
|
||||
|
||||
@@ -117,7 +117,7 @@ tower_token:
|
||||
returned: on successful create
|
||||
'''
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
|
||||
|
||||
def return_token(module, last_response):
|
||||
@@ -143,7 +143,7 @@ def main():
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(
|
||||
module = TowerAPIModule(
|
||||
argument_spec=argument_spec,
|
||||
mutually_exclusive=[
|
||||
('existing_token', 'existing_token_id'),
|
||||
|
||||
@@ -102,7 +102,7 @@ EXAMPLES = '''
|
||||
tower_config_file: "~/tower_cli.cfg"
|
||||
'''
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
|
||||
|
||||
def main():
|
||||
@@ -119,7 +119,7 @@ def main():
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(argument_spec=argument_spec)
|
||||
module = TowerAPIModule(argument_spec=argument_spec)
|
||||
|
||||
# Extract our parameters
|
||||
username = module.params.get('username')
|
||||
|
||||
@@ -137,7 +137,7 @@ EXAMPLES = '''
|
||||
organization: Default
|
||||
'''
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
|
||||
import json
|
||||
|
||||
@@ -176,7 +176,7 @@ def main():
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(argument_spec=argument_spec)
|
||||
module = TowerAPIModule(argument_spec=argument_spec)
|
||||
|
||||
# Extract our parameters
|
||||
name = module.params.get('name')
|
||||
|
||||
@@ -157,7 +157,7 @@ EXAMPLES = '''
|
||||
- my-first-node
|
||||
'''
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
|
||||
|
||||
def main():
|
||||
@@ -185,7 +185,7 @@ def main():
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(argument_spec=argument_spec)
|
||||
module = TowerAPIModule(argument_spec=argument_spec)
|
||||
|
||||
# Extract our parameters
|
||||
identifier = module.params.get('identifier')
|
||||
|
||||
@@ -91,9 +91,8 @@ EXAMPLES = '''
|
||||
wait: False
|
||||
'''
|
||||
|
||||
from ..module_utils.tower_api import TowerModule
|
||||
from ..module_utils.tower_api import TowerAPIModule
|
||||
import json
|
||||
import time
|
||||
|
||||
|
||||
def main():
|
||||
@@ -111,7 +110,7 @@ def main():
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
module = TowerModule(argument_spec=argument_spec)
|
||||
module = TowerAPIModule(argument_spec=argument_spec)
|
||||
|
||||
optional_args = {}
|
||||
# Extract our parameters
|
||||
@@ -178,26 +177,13 @@ def main():
|
||||
if not wait:
|
||||
module.exit_json(**module.json_output)
|
||||
|
||||
# Grab our start time to compare against for the timeout
|
||||
start = time.time()
|
||||
|
||||
job_url = result['json']['url']
|
||||
while not result['json']['finished']:
|
||||
# If we are past our time out fail with a message
|
||||
if timeout and timeout < time.time() - start:
|
||||
module.json_output['msg'] = "Monitoring aborted due to timeout"
|
||||
module.fail_json(**module.json_output)
|
||||
|
||||
# Put the process to sleep for our interval
|
||||
time.sleep(interval)
|
||||
|
||||
result = module.get_endpoint(job_url)
|
||||
module.json_output['status'] = result['json']['status']
|
||||
|
||||
# If the job has failed, we want to raise a task failure for that so we get a non-zero response.
|
||||
if result['json']['failed']:
|
||||
module.json_output['msg'] = 'The workflow "{0}" failed'.format(name)
|
||||
module.fail_json(**module.json_output)
|
||||
# Invoke wait function
|
||||
module.wait_on_url(
|
||||
url=result['json']['url'],
|
||||
object_name=name,
|
||||
object_type='Workflow Job',
|
||||
timeout=timeout, interval=interval
|
||||
)
|
||||
|
||||
module.exit_json(**module.json_output)
|
||||
|
||||
|
||||
@@ -108,8 +108,8 @@ EXAMPLES = '''
|
||||
RETURN = ''' # '''
|
||||
|
||||
|
||||
from ..module_utils.ansible_tower import (
|
||||
TowerModule,
|
||||
from ..module_utils.tower_legacy import (
|
||||
TowerLegacyModule,
|
||||
tower_auth_config,
|
||||
tower_check_mode
|
||||
)
|
||||
@@ -140,7 +140,7 @@ def main():
|
||||
state=dict(choices=['present', 'absent'], default='present'),
|
||||
)
|
||||
|
||||
module = TowerModule(
|
||||
module = TowerLegacyModule(
|
||||
argument_spec=argument_spec,
|
||||
supports_check_mode=False
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user