mirror of
https://github.com/ansible/awx.git
synced 2026-01-08 14:32:07 -03:30
more rename, mostly in test
This commit is contained in:
parent
a695274cb6
commit
7a63785255
@ -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.
|
||||
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -10,7 +10,7 @@ __metaclass__ = type
|
||||
|
||||
class ModuleDocFragment(object):
|
||||
|
||||
# Ansible Tower documentation fragment
|
||||
# Automation Controller documentation fragment
|
||||
DOCUMENTATION = r'''
|
||||
options:
|
||||
tower_host:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
'''
|
||||
|
||||
@ -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 }}
|
||||
|
||||
@ -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",
|
||||
}
|
||||
|
||||
@ -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()
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
'''
|
||||
|
||||
|
||||
@ -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
|
||||
'''
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
'''
|
||||
|
||||
@ -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
|
||||
'''
|
||||
|
||||
@ -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'
|
||||
'''
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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() }}"
|
||||
'''
|
||||
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 = '''
|
||||
|
||||
@ -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
|
||||
'''
|
||||
|
||||
|
||||
@ -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
|
||||
'''
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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
|
||||
'''
|
||||
|
||||
@ -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
|
||||
'''
|
||||
|
||||
@ -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"
|
||||
'''
|
||||
|
||||
|
||||
@ -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') }}"
|
||||
'''
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
'''
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
'''
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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'}}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
'''
|
||||
|
||||
@ -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
|
||||
@ -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."}
|
||||
|
||||
@ -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')
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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"}]},
|
||||
|
||||
@ -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 == {
|
||||
|
||||
@ -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,
|
||||
)
|
||||
|
||||
@ -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,
|
||||
)
|
||||
|
||||
@ -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/'
|
||||
),
|
||||
|
||||
@ -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."}
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
@ -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']
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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')
|
||||
|
||||
@ -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,
|
||||
)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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}
|
||||
|
||||
@ -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')
|
||||
|
||||
@ -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'])
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -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']
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 }}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user