mirror of
https://github.com/ansible/awx.git
synced 2026-03-03 17:51:06 -03:30
more rename, mostly in test
This commit is contained in:
@@ -71,9 +71,8 @@ Notable releases of the `awx.awx` collection:
|
|||||||
|
|
||||||
The following notes are changes that may require changes to playbooks:
|
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 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.
|
- Creating a "scan" type job template is no longer supported.
|
||||||
- Specifying a custom certificate via the `TOWER_CERTIFICATE` environment variable no longer works.
|
- Specifying a custom certificate via the `TOWER_CERTIFICATE` environment variable no longer works.
|
||||||
- Type changes of variable fields:
|
- Type changes of variable fields:
|
||||||
@@ -118,7 +117,7 @@ py.test awx_collection/test/awx/
|
|||||||
|
|
||||||
## Running Integration Tests
|
## 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`.
|
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.
|
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,
|
'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
|
assert result.get('changed'), result
|
||||||
|
|
||||||
tokens = OAuth2AccessToken.objects.filter(description='barfoo')
|
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
|
- Cleanup created objects
|
||||||
```
|
```
|
||||||
- name: Delete the credential
|
- name: Delete the credential
|
||||||
tower_credential:
|
credential:
|
||||||
name: "{{ cred_name1 }}"
|
name: "{{ cred_name1 }}"
|
||||||
organization: "Default"
|
organization: "Default"
|
||||||
credential_type: "OpenShift or Kubernetes API Bearer Token"
|
credential_type: "OpenShift or Kubernetes API Bearer Token"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ __metaclass__ = type
|
|||||||
|
|
||||||
class ModuleDocFragment(object):
|
class ModuleDocFragment(object):
|
||||||
|
|
||||||
# Ansible Tower documentation fragment
|
# Automation Controller documentation fragment
|
||||||
DOCUMENTATION = r'''
|
DOCUMENTATION = r'''
|
||||||
options:
|
options:
|
||||||
tower_host:
|
tower_host:
|
||||||
|
|||||||
@@ -10,19 +10,19 @@ __metaclass__ = type
|
|||||||
|
|
||||||
class ModuleDocFragment(object):
|
class ModuleDocFragment(object):
|
||||||
|
|
||||||
# Ansible Tower documentation fragment
|
# Automation Controller documentation fragment
|
||||||
DOCUMENTATION = r'''
|
DOCUMENTATION = r'''
|
||||||
options:
|
options:
|
||||||
host:
|
host:
|
||||||
description: The network address of your Ansible Tower host.
|
description: The network address of your Automation Controller host.
|
||||||
env:
|
env:
|
||||||
- name: TOWER_HOST
|
- name: TOWER_HOST
|
||||||
username:
|
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:
|
env:
|
||||||
- name: TOWER_USERNAME
|
- name: TOWER_USERNAME
|
||||||
password:
|
password:
|
||||||
description: The password for your Ansible Tower user.
|
description: The password for your Automation Controller user.
|
||||||
env:
|
env:
|
||||||
- name: TOWER_PASSWORD
|
- name: TOWER_PASSWORD
|
||||||
oauth_token:
|
oauth_token:
|
||||||
@@ -32,7 +32,7 @@ options:
|
|||||||
- name: TOWER_OAUTH_TOKEN
|
- name: TOWER_OAUTH_TOKEN
|
||||||
verify_ssl:
|
verify_ssl:
|
||||||
description:
|
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
|
- Defaults to True, but this is handled by the shared module_utils code
|
||||||
type: bool
|
type: bool
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ plugin_type: inventory
|
|||||||
author:
|
author:
|
||||||
- Matthew Jones (@matburt)
|
- Matthew Jones (@matburt)
|
||||||
- Yunfan Zhang (@YunfanZhang42)
|
- Yunfan Zhang (@YunfanZhang42)
|
||||||
short_description: Ansible dynamic inventory plugin for Ansible Tower.
|
short_description: Ansible dynamic inventory plugin for Automation Controller.
|
||||||
description:
|
description:
|
||||||
- Reads inventories from Ansible Tower.
|
- Reads inventories from Automation Controller.
|
||||||
- Supports reading configuration from both YAML config file and environment variables.
|
- 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),
|
- 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
|
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:
|
options:
|
||||||
inventory_id:
|
inventory_id:
|
||||||
description:
|
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.
|
- 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.
|
- 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".
|
- Named URL slugs follow the syntax of "inventory_name++organization_name".
|
||||||
@@ -32,7 +32,7 @@ options:
|
|||||||
- name: TOWER_INVENTORY
|
- name: TOWER_INVENTORY
|
||||||
required: True
|
required: True
|
||||||
include_metadata:
|
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
|
type: bool
|
||||||
default: False
|
default: False
|
||||||
'''
|
'''
|
||||||
@@ -59,7 +59,7 @@ inventory_id: the_ID_of_targeted_ansible_tower_inventory
|
|||||||
# export TOWER_USERNAME=YOUR_TOWER_USERNAME
|
# export TOWER_USERNAME=YOUR_TOWER_USERNAME
|
||||||
# export TOWER_PASSWORD=YOUR_TOWER_PASSWORD
|
# export TOWER_PASSWORD=YOUR_TOWER_PASSWORD
|
||||||
# export TOWER_INVENTORY=THE_ID_OF_TARGETED_INVENTORY
|
# 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.
|
# The inventory path must always be @tower_inventory if you are reading all settings from environment variables.
|
||||||
# ansible-inventory -i @tower_inventory --list
|
# ansible-inventory -i @tower_inventory --list
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ from __future__ import absolute_import, division, print_function
|
|||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = """
|
DOCUMENTATION = """
|
||||||
lookup: tower_api
|
lookup: controller_api
|
||||||
author: John Westcott IV (@john-westcott-iv)
|
author: John Westcott IV (@john-westcott-iv)
|
||||||
short_description: Search the API for objects
|
short_description: Search the API for objects
|
||||||
requirements:
|
requirements:
|
||||||
- None
|
- None
|
||||||
description:
|
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.
|
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
|
- For use that is cross-compatible between the awx.awx and ansible.tower collection
|
||||||
see the tower_meta module
|
see the tower_meta module
|
||||||
@@ -71,20 +71,20 @@ notes:
|
|||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
- name: Load the UI settings
|
- name: Load the UI settings
|
||||||
set_fact:
|
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
|
- name: Load the UI settings specifying the connection info
|
||||||
set_fact:
|
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
|
- name: Report the usernames of all users with admin privs
|
||||||
debug:
|
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
|
- name: debug all organizations in a loop # use query to return a list
|
||||||
debug:
|
debug:
|
||||||
msg: "Organization description={{ item['description'] }} id={{ item['id'] }}"
|
msg: "Organization description={{ item['description'] }} id={{ item['id'] }}"
|
||||||
loop: "{{ query('awx.awx.tower_api', 'organizations') }}"
|
loop: "{{ query('awx.awx.controller_api', 'organizations') }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item['name'] }}"
|
label: "{{ item['name'] }}"
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ EXAMPLES = """
|
|||||||
organization: Default
|
organization: Default
|
||||||
role: admin
|
role: admin
|
||||||
user: john
|
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
|
- name: Create an inventory group with all 'foo' hosts
|
||||||
tower_group:
|
tower_group:
|
||||||
@@ -101,7 +101,7 @@ EXAMPLES = """
|
|||||||
inventory: "Demo Inventory"
|
inventory: "Demo Inventory"
|
||||||
hosts: >-
|
hosts: >-
|
||||||
{{ query(
|
{{ query(
|
||||||
'awx.awx.tower_api',
|
'awx.awx.controller_api',
|
||||||
'hosts',
|
'hosts',
|
||||||
query_params={ 'name__startswith' : 'foo', },
|
query_params={ 'name__startswith' : 'foo', },
|
||||||
) | map(attribute='name') | list }}
|
) | map(attribute='name') | list }}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class ControllerAPIModule(ControllerModule):
|
|||||||
# Those values can be found in awx/api/generics.py line 204
|
# Those values can be found in awx/api/generics.py line 204
|
||||||
collection_to_version = {
|
collection_to_version = {
|
||||||
'awx': 'AWX',
|
'awx': 'AWX',
|
||||||
'tower': 'Red Hat Ansible Tower',
|
'tower': 'Red Hat Automation Controller',
|
||||||
}
|
}
|
||||||
session = None
|
session = None
|
||||||
IDENTITY_FIELDS = {'users': 'username', 'workflow_job_template_nodes': 'identifier', 'instances': 'hostname'}
|
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
|
# 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
|
# If we have a username and password, we need to get a session cookie
|
||||||
login_data = {
|
login_data = {
|
||||||
"description": "Ansible Tower Module Token",
|
"description": "Automation Controller Module Token",
|
||||||
"application": None,
|
"application": None,
|
||||||
"scope": "write",
|
"scope": "write",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ def tower_auth_config(module):
|
|||||||
|
|
||||||
|
|
||||||
def tower_check_mode(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:
|
if module.check_mode:
|
||||||
try:
|
try:
|
||||||
result = client.get('/ping').json()
|
result = client.get('/ping').json()
|
||||||
@@ -14,12 +14,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_ad_hoc_command
|
module: ad_hoc_command
|
||||||
author: "John Westcott IV (@john-westcott-iv)"
|
author: "John Westcott IV (@john-westcott-iv)"
|
||||||
version_added: "4.0"
|
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:
|
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.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
job_type:
|
job_type:
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_ad_hoc_command_cancel
|
module: ad_hoc_command_cancel
|
||||||
author: "John Westcott IV (@john-westcott-iv)"
|
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:
|
description:
|
||||||
- Cancel Ansible Tower ad hoc command. See
|
- Cancel Automation Controller ad hoc command. See
|
||||||
U(https://www.ansible.com/tower) for an overview.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
command_id:
|
command_id:
|
||||||
@@ -47,7 +47,7 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Cancel command
|
- name: Cancel command
|
||||||
tower_ad_hoc_command_cancel:
|
ad_hoc_command_cancel:
|
||||||
command_id: command.id
|
command_id: command.id
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_ad_hoc_command_wait
|
module: ad_hoc_command_wait
|
||||||
author: "John Westcott IV (@john-westcott-iv)"
|
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:
|
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.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
command_id:
|
command_id:
|
||||||
@@ -41,14 +41,14 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Launch an ad hoc command
|
- name: Launch an ad hoc command
|
||||||
tower_ad_hoc_command:
|
ad_hoc_command:
|
||||||
inventory: "Demo Inventory"
|
inventory: "Demo Inventory"
|
||||||
credential: "Demo Credential"
|
credential: "Demo Credential"
|
||||||
wait: false
|
wait: false
|
||||||
register: command
|
register: command
|
||||||
|
|
||||||
- name: Wait for ad joc command max 120s
|
- name: Wait for ad joc command max 120s
|
||||||
tower_ad_hoc_command_wait:
|
ad_hoc_command_wait:
|
||||||
command_id: "{{ command.id }}"
|
command_id: "{{ command.id }}"
|
||||||
timeout: 120
|
timeout: 120
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_application
|
module: application
|
||||||
author: "Geoffrey Bacheot (@jffz)"
|
author: "Geoffrey Bacheot (@jffz)"
|
||||||
short_description: create, update, or destroy Ansible Tower applications
|
short_description: create, update, or destroy Automation Controller applications
|
||||||
description:
|
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.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
@@ -69,7 +69,7 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Add Foo application
|
- name: Add Foo application
|
||||||
tower_application:
|
application:
|
||||||
name: "Foo"
|
name: "Foo"
|
||||||
description: "Foo bar application"
|
description: "Foo bar application"
|
||||||
organization: "test"
|
organization: "test"
|
||||||
@@ -78,7 +78,7 @@ EXAMPLES = '''
|
|||||||
client-type: public
|
client-type: public
|
||||||
|
|
||||||
- name: Add Foo application
|
- name: Add Foo application
|
||||||
tower_application:
|
application:
|
||||||
name: "Foo"
|
name: "Foo"
|
||||||
description: "Foo bar application"
|
description: "Foo bar application"
|
||||||
organization: "test"
|
organization: "test"
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_credential
|
module: credential
|
||||||
author: "Wayne Witzel III (@wwitzel3)"
|
author: "Wayne Witzel III (@wwitzel3)"
|
||||||
short_description: create, update, or destroy Ansible Tower credential.
|
short_description: create, update, or destroy Automation Controller credential.
|
||||||
description:
|
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.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
@@ -56,7 +56,7 @@ options:
|
|||||||
description:
|
description:
|
||||||
- >-
|
- >-
|
||||||
Credential inputs where the keys are var names used in templating.
|
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)
|
- Any fields in this dict will take prescedence over any fields mentioned below (i.e. host, username, etc)
|
||||||
type: dict
|
type: dict
|
||||||
update_secrets:
|
update_secrets:
|
||||||
@@ -204,7 +204,7 @@ notes:
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Add tower machine credential
|
- name: Add tower machine credential
|
||||||
tower_credential:
|
credential:
|
||||||
name: Team Name
|
name: Team Name
|
||||||
description: Team Description
|
description: Team Description
|
||||||
organization: test-org
|
organization: test-org
|
||||||
@@ -213,7 +213,7 @@ EXAMPLES = '''
|
|||||||
tower_config_file: "~/tower_cli.cfg"
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
- name: Create a valid SCM credential from a private_key file
|
- name: Create a valid SCM credential from a private_key file
|
||||||
tower_credential:
|
credential:
|
||||||
name: SCM Credential
|
name: SCM Credential
|
||||||
organization: Default
|
organization: Default
|
||||||
state: present
|
state: present
|
||||||
@@ -230,7 +230,7 @@ EXAMPLES = '''
|
|||||||
register: aws_ssh_key
|
register: aws_ssh_key
|
||||||
|
|
||||||
- name: Add Credential Into Tower
|
- name: Add Credential Into Tower
|
||||||
tower_credential:
|
credential:
|
||||||
name: Workshop Credential
|
name: Workshop Credential
|
||||||
credential_type: Machine
|
credential_type: Machine
|
||||||
organization: Default
|
organization: Default
|
||||||
@@ -240,7 +240,7 @@ EXAMPLES = '''
|
|||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
|
||||||
- name: Add Credential with Custom Credential Type
|
- name: Add Credential with Custom Credential Type
|
||||||
tower_credential:
|
credential:
|
||||||
name: Workshop Credential
|
name: Workshop Credential
|
||||||
credential_type: MyCloudCredential
|
credential_type: MyCloudCredential
|
||||||
organization: Default
|
organization: Default
|
||||||
@@ -249,7 +249,7 @@ EXAMPLES = '''
|
|||||||
tower_host: https://localhost
|
tower_host: https://localhost
|
||||||
|
|
||||||
- name: Create a Vaiult credential (example for notes)
|
- name: Create a Vaiult credential (example for notes)
|
||||||
tower_credential:
|
credential:
|
||||||
name: Example password
|
name: Example password
|
||||||
credential_type: Vault
|
credential_type: Vault
|
||||||
organization: Default
|
organization: Default
|
||||||
@@ -258,7 +258,7 @@ EXAMPLES = '''
|
|||||||
vault_id: 'My ID'
|
vault_id: 'My ID'
|
||||||
|
|
||||||
- name: Bad password update (will replace vault_id)
|
- name: Bad password update (will replace vault_id)
|
||||||
tower_credential:
|
credential:
|
||||||
name: Example password
|
name: Example password
|
||||||
credential_type: Vault
|
credential_type: Vault
|
||||||
organization: Default
|
organization: Default
|
||||||
@@ -266,14 +266,14 @@ EXAMPLES = '''
|
|||||||
vault_password: 'new_password'
|
vault_password: 'new_password'
|
||||||
|
|
||||||
- name: Another bad password update (will replace vault_id)
|
- name: Another bad password update (will replace vault_id)
|
||||||
tower_credential:
|
credential:
|
||||||
name: Example password
|
name: Example password
|
||||||
credential_type: Vault
|
credential_type: Vault
|
||||||
organization: Default
|
organization: Default
|
||||||
vault_password: 'new_password'
|
vault_password: 'new_password'
|
||||||
|
|
||||||
- name: A safe way to update a password and keep vault_id
|
- name: A safe way to update a password and keep vault_id
|
||||||
tower_credential:
|
credential:
|
||||||
name: Example password
|
name: Example password
|
||||||
credential_type: Vault
|
credential_type: Vault
|
||||||
organization: Default
|
organization: Default
|
||||||
@@ -282,7 +282,7 @@ EXAMPLES = '''
|
|||||||
vault_id: 'My ID'
|
vault_id: 'My ID'
|
||||||
|
|
||||||
- name: Copy Credential
|
- name: Copy Credential
|
||||||
tower_credential:
|
credential:
|
||||||
name: Copy password
|
name: Copy password
|
||||||
copy_from: Example password
|
copy_from: Example password
|
||||||
credential_type: Vault
|
credential_type: Vault
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_credential_input_source
|
module: credential_input_source
|
||||||
author: "Tom Page (@Tompage1994)"
|
author: "Tom Page (@Tompage1994)"
|
||||||
version_added: "2.3"
|
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:
|
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.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
description:
|
description:
|
||||||
@@ -58,7 +58,7 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Use CyberArk Lookup credential as password source
|
- name: Use CyberArk Lookup credential as password source
|
||||||
tower_credential_input_source:
|
credential_input_source:
|
||||||
input_field_name: password
|
input_field_name: password
|
||||||
target_credential: new_cred
|
target_credential: new_cred
|
||||||
source_credential: cyberark_lookup
|
source_credential: cyberark_lookup
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'metadat
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_credential_type
|
module: credential_type
|
||||||
author: "Adrien Fleury (@fleu42)"
|
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:
|
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.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
@@ -49,7 +49,7 @@ options:
|
|||||||
description:
|
description:
|
||||||
- >-
|
- >-
|
||||||
Enter injectors using either JSON or YAML syntax. Refer to the
|
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
|
type: dict
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
@@ -62,7 +62,7 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- tower_credential_type:
|
- credential_type:
|
||||||
name: Nexus
|
name: Nexus
|
||||||
description: Credentials type for Nexus
|
description: Credentials type for Nexus
|
||||||
kind: cloud
|
kind: cloud
|
||||||
@@ -71,7 +71,7 @@ EXAMPLES = '''
|
|||||||
state: present
|
state: present
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
|
|
||||||
- tower_credential_type:
|
- credential_type:
|
||||||
name: Nexus
|
name: Nexus
|
||||||
state: absent
|
state: absent
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_execution_environment
|
module: execution_environment
|
||||||
author: "Shane McDonald (@shanemcd)"
|
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:
|
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.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
@@ -61,7 +61,7 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Add EE to Tower
|
- name: Add EE to Tower
|
||||||
tower_execution_environment:
|
execution_environment:
|
||||||
name: "My EE"
|
name: "My EE"
|
||||||
image: quay.io/ansible/awx-ee
|
image: quay.io/ansible/awx-ee
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_export
|
module: export
|
||||||
author: "John Westcott IV (@john-westcott-iv)"
|
author: "John Westcott IV (@john-westcott-iv)"
|
||||||
version_added: "3.7"
|
version_added: "3.7"
|
||||||
short_description: export resources from Ansible Tower.
|
short_description: export resources from Automation Controller.
|
||||||
description:
|
description:
|
||||||
- Export assets from Ansible Tower.
|
- Export assets from Automation Controller.
|
||||||
options:
|
options:
|
||||||
all:
|
all:
|
||||||
description:
|
description:
|
||||||
@@ -83,15 +83,15 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Export all tower assets
|
- name: Export all tower assets
|
||||||
tower_export:
|
export:
|
||||||
all: True
|
all: True
|
||||||
|
|
||||||
- name: Export all inventories
|
- name: Export all inventories
|
||||||
tower_export:
|
export:
|
||||||
inventory: 'all'
|
inventory: 'all'
|
||||||
|
|
||||||
- name: Export a job template named "My Template" and all Credentials
|
- name: Export a job template named "My Template" and all Credentials
|
||||||
tower_export:
|
export:
|
||||||
job_template: "My Template"
|
job_template: "My Template"
|
||||||
credential: 'all'
|
credential: 'all'
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_group
|
module: group
|
||||||
author: "Wayne Witzel III (@wwitzel3)"
|
author: "Wayne Witzel III (@wwitzel3)"
|
||||||
short_description: create, update, or destroy Ansible Tower group.
|
short_description: create, update, or destroy Automation Controller group.
|
||||||
description:
|
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.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
@@ -79,7 +79,7 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Add tower group
|
- name: Add tower group
|
||||||
tower_group:
|
group:
|
||||||
name: localhost
|
name: localhost
|
||||||
description: "Local Host Group"
|
description: "Local Host Group"
|
||||||
inventory: "Local Inventory"
|
inventory: "Local Inventory"
|
||||||
@@ -87,7 +87,7 @@ EXAMPLES = '''
|
|||||||
tower_config_file: "~/tower_cli.cfg"
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
- name: Add tower group
|
- name: Add tower group
|
||||||
tower_group:
|
group:
|
||||||
name: Cities
|
name: Cities
|
||||||
description: "Local Host Group"
|
description: "Local Host Group"
|
||||||
inventory: Default Inventory
|
inventory: Default Inventory
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_host
|
module: host
|
||||||
author: "Wayne Witzel III (@wwitzel3)"
|
author: "Wayne Witzel III (@wwitzel3)"
|
||||||
short_description: create, update, or destroy Ansible Tower host.
|
short_description: create, update, or destroy Automation Controller host.
|
||||||
description:
|
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.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
@@ -60,7 +60,7 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Add tower host
|
- name: Add tower host
|
||||||
tower_host:
|
host:
|
||||||
name: localhost
|
name: localhost
|
||||||
description: "Local Host Group"
|
description: "Local Host Group"
|
||||||
inventory: "Local Inventory"
|
inventory: "Local Inventory"
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_import
|
module: import
|
||||||
author: "John Westcott (@john-westcott-iv)"
|
author: "John Westcott (@john-westcott-iv)"
|
||||||
version_added: "3.7"
|
version_added: "3.7"
|
||||||
short_description: import resources into Ansible Tower.
|
short_description: import resources into Automation Controller.
|
||||||
description:
|
description:
|
||||||
- Import assets into Ansible Tower. See
|
- Import assets into Automation Controller. See
|
||||||
U(https://www.ansible.com/tower) for an overview.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
assets:
|
assets:
|
||||||
@@ -35,16 +35,16 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Export all assets
|
- name: Export all assets
|
||||||
tower_export:
|
export:
|
||||||
all: True
|
all: True
|
||||||
register: export_output
|
register: export_output
|
||||||
|
|
||||||
- name: Import all tower assets from our export
|
- name: Import all tower assets from our export
|
||||||
tower_import:
|
import:
|
||||||
assets: "{{ export_output.assets }}"
|
assets: "{{ export_output.assets }}"
|
||||||
|
|
||||||
- name: Load data from a json file created by a command like awx export --organization Default
|
- 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() }}"
|
assets: "{{ lookup('file', 'org.json') | from_json() }}"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_instance_group
|
module: instance_group
|
||||||
author: "John Westcott IV (@john-westcott-iv)"
|
author: "John Westcott IV (@john-westcott-iv)"
|
||||||
version_added: "4.0"
|
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:
|
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.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_inventory
|
module: inventory
|
||||||
author: "Wayne Witzel III (@wwitzel3)"
|
author: "Wayne Witzel III (@wwitzel3)"
|
||||||
short_description: create, update, or destroy Ansible Tower inventory.
|
short_description: create, update, or destroy Automation Controller inventory.
|
||||||
description:
|
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.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
@@ -78,7 +78,7 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Add tower inventory
|
- name: Add tower inventory
|
||||||
tower_inventory:
|
inventory:
|
||||||
name: "Foo Inventory"
|
name: "Foo Inventory"
|
||||||
description: "Our Foo Cloud Servers"
|
description: "Our Foo Cloud Servers"
|
||||||
organization: "Bar Org"
|
organization: "Bar Org"
|
||||||
@@ -86,7 +86,7 @@ EXAMPLES = '''
|
|||||||
tower_config_file: "~/tower_cli.cfg"
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
- name: Copy tower inventory
|
- name: Copy tower inventory
|
||||||
tower_inventory:
|
inventory:
|
||||||
name: Copy Foo Inventory
|
name: Copy Foo Inventory
|
||||||
copy_from: Default Inventory
|
copy_from: Default Inventory
|
||||||
description: "Our Foo Cloud Servers"
|
description: "Our Foo Cloud Servers"
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_inventory_source
|
module: inventory_source
|
||||||
author: "Adrien Fleury (@fleu42)"
|
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:
|
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.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
@@ -138,7 +138,7 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Add an inventory source
|
- name: Add an inventory source
|
||||||
tower_inventory_source:
|
inventory_source:
|
||||||
name: "source-inventory"
|
name: "source-inventory"
|
||||||
description: Source for inventory
|
description: Source for inventory
|
||||||
inventory: previously-created-inventory
|
inventory: previously-created-inventory
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_inventory_source_update
|
module: inventory_source_update
|
||||||
author: "Bianca Henderson (@beeankha)"
|
author: "Bianca Henderson (@beeankha)"
|
||||||
short_description: Update inventory source(s).
|
short_description: Update inventory source(s).
|
||||||
description:
|
description:
|
||||||
- Update Ansible Tower inventory source(s). See
|
- Update Automation Controller inventory source(s). See
|
||||||
U(https://www.ansible.com/tower) for an overview.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
@@ -58,16 +58,16 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Update a single inventory source
|
- name: Update a single inventory source
|
||||||
tower_inventory_source_update:
|
inventory_source_update:
|
||||||
name: "Example Inventory Source"
|
name: "Example Inventory Source"
|
||||||
inventory: "My Inventory"
|
inventory: "My Inventory"
|
||||||
organization: Default
|
organization: Default
|
||||||
|
|
||||||
- name: Update all inventory sources
|
- name: Update all inventory sources
|
||||||
tower_inventory_source_update:
|
inventory_source_update:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
inventory: "My Other Inventory"
|
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 = '''
|
RETURN = '''
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_job_cancel
|
module: job_cancel
|
||||||
author: "Wayne Witzel III (@wwitzel3)"
|
author: "Wayne Witzel III (@wwitzel3)"
|
||||||
short_description: Cancel an Ansible Tower Job.
|
short_description: Cancel an Automation Controller Job.
|
||||||
description:
|
description:
|
||||||
- Cancel Ansible Tower jobs. See
|
- Cancel Automation Controller jobs. See
|
||||||
U(https://www.ansible.com/tower) for an overview.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
job_id:
|
job_id:
|
||||||
@@ -36,7 +36,7 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Cancel job
|
- name: Cancel job
|
||||||
tower_job_cancel:
|
job_cancel:
|
||||||
job_id: job.id
|
job_id: job.id
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_job_launch
|
module: job_launch
|
||||||
author: "Wayne Witzel III (@wwitzel3)"
|
author: "Wayne Witzel III (@wwitzel3)"
|
||||||
short_description: Launch an Ansible Job.
|
short_description: Launch an Ansible Job.
|
||||||
description:
|
description:
|
||||||
- Launch an Ansible Tower jobs. See
|
- Launch an Automation Controller jobs. See
|
||||||
U(https://www.ansible.com/tower) for an overview.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
@@ -107,12 +107,12 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Launch a job
|
- name: Launch a job
|
||||||
tower_job_launch:
|
job_launch:
|
||||||
job_template: "My Job Template"
|
job_template: "My Job Template"
|
||||||
register: job
|
register: job
|
||||||
|
|
||||||
- name: Launch a job template with extra_vars on remote Tower instance
|
- name: Launch a job template with extra_vars on remote Tower instance
|
||||||
tower_job_launch:
|
job_launch:
|
||||||
job_template: "My Job Template"
|
job_template: "My Job Template"
|
||||||
extra_vars:
|
extra_vars:
|
||||||
var1: "My First Variable"
|
var1: "My First Variable"
|
||||||
@@ -121,13 +121,13 @@ EXAMPLES = '''
|
|||||||
job_type: run
|
job_type: run
|
||||||
|
|
||||||
- name: Launch a job with inventory and credential
|
- name: Launch a job with inventory and credential
|
||||||
tower_job_launch:
|
job_launch:
|
||||||
job_template: "My Job Template"
|
job_template: "My Job Template"
|
||||||
inventory: "My Inventory"
|
inventory: "My Inventory"
|
||||||
credential: "My Credential"
|
credential: "My Credential"
|
||||||
register: job
|
register: job
|
||||||
- name: Wait for job max 120s
|
- name: Wait for job max 120s
|
||||||
tower_job_wait:
|
job_wait:
|
||||||
job_id: "{{ job.id }}"
|
job_id: "{{ job.id }}"
|
||||||
timeout: 120
|
timeout: 120
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_job_list
|
module: job_list
|
||||||
author: "Wayne Witzel III (@wwitzel3)"
|
author: "Wayne Witzel III (@wwitzel3)"
|
||||||
short_description: List Ansible Tower jobs.
|
short_description: List Automation Controller jobs.
|
||||||
description:
|
description:
|
||||||
- List Ansible Tower jobs. See
|
- List Automation Controller jobs. See
|
||||||
U(https://www.ansible.com/tower) for an overview.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
status:
|
status:
|
||||||
@@ -45,7 +45,7 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: List running jobs for the testing.yml playbook
|
- name: List running jobs for the testing.yml playbook
|
||||||
tower_job_list:
|
job_list:
|
||||||
status: running
|
status: running
|
||||||
query: {"playbook": "testing.yml"}
|
query: {"playbook": "testing.yml"}
|
||||||
tower_config_file: "~/tower_cli.cfg"
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_job_template
|
module: job_template
|
||||||
author: "Wayne Witzel III (@wwitzel3)"
|
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:
|
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.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
@@ -305,7 +305,7 @@ notes:
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Create Tower Ping job template
|
- name: Create Tower Ping job template
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "Ping"
|
name: "Ping"
|
||||||
job_type: "run"
|
job_type: "run"
|
||||||
organization: "Default"
|
organization: "Default"
|
||||||
@@ -320,20 +320,20 @@ EXAMPLES = '''
|
|||||||
survey_spec: "{{ lookup('file', 'my_survey.json') }}"
|
survey_spec: "{{ lookup('file', 'my_survey.json') }}"
|
||||||
|
|
||||||
- name: Add start notification to Job Template
|
- name: Add start notification to Job Template
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "Ping"
|
name: "Ping"
|
||||||
notification_templates_started:
|
notification_templates_started:
|
||||||
- Notification1
|
- Notification1
|
||||||
- Notification2
|
- Notification2
|
||||||
|
|
||||||
- name: Remove Notification1 start notification from Job Template
|
- name: Remove Notification1 start notification from Job Template
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "Ping"
|
name: "Ping"
|
||||||
notification_templates_started:
|
notification_templates_started:
|
||||||
- Notification2
|
- Notification2
|
||||||
|
|
||||||
- name: Copy Job Template
|
- name: Copy Job Template
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: copy job template
|
name: copy job template
|
||||||
copy_from: test job template
|
copy_from: test job template
|
||||||
job_type: "run"
|
job_type: "run"
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_job_wait
|
module: job_wait
|
||||||
author: "Wayne Witzel III (@wwitzel3)"
|
author: "Wayne Witzel III (@wwitzel3)"
|
||||||
short_description: Wait for Ansible Tower job to finish.
|
short_description: Wait for Automation Controller job to finish.
|
||||||
description:
|
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.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
job_id:
|
job_id:
|
||||||
@@ -58,12 +58,12 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Launch a job
|
- name: Launch a job
|
||||||
tower_job_launch:
|
job_launch:
|
||||||
job_template: "My Job Template"
|
job_template: "My Job Template"
|
||||||
register: job
|
register: job
|
||||||
|
|
||||||
- name: Wait for job max 120s
|
- name: Wait for job max 120s
|
||||||
tower_job_wait:
|
job_wait:
|
||||||
job_id: "{{ job.id }}"
|
job_id: "{{ job.id }}"
|
||||||
timeout: 120
|
timeout: 120
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_label
|
module: label
|
||||||
author: "Wayne Witzel III (@wwitzel3)"
|
author: "Wayne Witzel III (@wwitzel3)"
|
||||||
short_description: create, update, or destroy Ansible Tower labels.
|
short_description: create, update, or destroy Automation Controller labels.
|
||||||
description:
|
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.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
- Note, labels can only be created via the Tower API, they can not be deleted.
|
- Note, labels can only be created via the Tower API, they can not be deleted.
|
||||||
Once they are fully disassociated the API will clean them up on its own.
|
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 = '''
|
EXAMPLES = '''
|
||||||
- name: Add label to tower organization
|
- name: Add label to tower organization
|
||||||
tower_label:
|
label:
|
||||||
name: Custom Label
|
name: Custom Label
|
||||||
organization: My Organization
|
organization: My Organization
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_license
|
module: license
|
||||||
author: "John Westcott IV (@john-westcott-iv)"
|
author: "John Westcott IV (@john-westcott-iv)"
|
||||||
short_description: Set the license for Ansible Tower
|
short_description: Set the license for Automation Controller
|
||||||
description:
|
description:
|
||||||
- Get or Set Ansible Tower license. See
|
- Get or Set Automation Controller license. See
|
||||||
U(https://www.ansible.com/tower) for an overview.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
manifest:
|
manifest:
|
||||||
@@ -39,7 +39,7 @@ RETURN = ''' # '''
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Set the license using a file
|
- name: Set the license using a file
|
||||||
tower_license:
|
license:
|
||||||
manifest: "/tmp/my_manifest.zip"
|
manifest: "/tmp/my_manifest.zip"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_meta
|
module: meta
|
||||||
author: "Alan Rominger (@alancoding)"
|
author: "Alan Rominger (@alancoding)"
|
||||||
short_description: Returns metadata about the collection this module lives in.
|
short_description: Returns metadata about the collection this module lives in.
|
||||||
description:
|
description:
|
||||||
@@ -49,7 +49,7 @@ version:
|
|||||||
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- tower_meta:
|
- meta:
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Show details about the collection
|
- name: Show details about the collection
|
||||||
@@ -57,7 +57,7 @@ EXAMPLES = '''
|
|||||||
|
|
||||||
- name: Load the UI setting without hard-coding the collection name
|
- name: Load the UI setting without hard-coding the collection name
|
||||||
debug:
|
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 = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_notification_template
|
module: notification_template
|
||||||
author: "Samuel Carpentier (@samcarpentier)"
|
author: "Samuel Carpentier (@samcarpentier)"
|
||||||
short_description: create, update, or destroy Ansible Tower notification.
|
short_description: create, update, or destroy Automation Controller notification.
|
||||||
description:
|
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.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
@@ -210,7 +210,7 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Add Slack notification with custom messages
|
- name: Add Slack notification with custom messages
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: slack notification
|
name: slack notification
|
||||||
organization: Default
|
organization: Default
|
||||||
notification_type: slack
|
notification_type: slack
|
||||||
@@ -229,7 +229,7 @@ EXAMPLES = '''
|
|||||||
tower_config_file: "~/tower_cli.cfg"
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
- name: Add webhook notification
|
- name: Add webhook notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: webhook notification
|
name: webhook notification
|
||||||
notification_type: webhook
|
notification_type: webhook
|
||||||
notification_configuration:
|
notification_configuration:
|
||||||
@@ -240,7 +240,7 @@ EXAMPLES = '''
|
|||||||
tower_config_file: "~/tower_cli.cfg"
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
- name: Add email notification
|
- name: Add email notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: email notification
|
name: email notification
|
||||||
notification_type: email
|
notification_type: email
|
||||||
notification_configuration:
|
notification_configuration:
|
||||||
@@ -257,7 +257,7 @@ EXAMPLES = '''
|
|||||||
tower_config_file: "~/tower_cli.cfg"
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
- name: Add twilio notification
|
- name: Add twilio notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: twilio notification
|
name: twilio notification
|
||||||
notification_type: twilio
|
notification_type: twilio
|
||||||
notification_configuration:
|
notification_configuration:
|
||||||
@@ -270,7 +270,7 @@ EXAMPLES = '''
|
|||||||
tower_config_file: "~/tower_cli.cfg"
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
- name: Add PagerDuty notification
|
- name: Add PagerDuty notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: pagerduty notification
|
name: pagerduty notification
|
||||||
notification_type: pagerduty
|
notification_type: pagerduty
|
||||||
notification_configuration:
|
notification_configuration:
|
||||||
@@ -282,7 +282,7 @@ EXAMPLES = '''
|
|||||||
tower_config_file: "~/tower_cli.cfg"
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
- name: Add IRC notification
|
- name: Add IRC notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: irc notification
|
name: irc notification
|
||||||
notification_type: irc
|
notification_type: irc
|
||||||
notification_configuration:
|
notification_configuration:
|
||||||
@@ -297,13 +297,13 @@ EXAMPLES = '''
|
|||||||
tower_config_file: "~/tower_cli.cfg"
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
- name: Delete notification
|
- name: Delete notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: old notification
|
name: old notification
|
||||||
state: absent
|
state: absent
|
||||||
tower_config_file: "~/tower_cli.cfg"
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
- name: Copy webhook notification
|
- name: Copy webhook notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: foo notification
|
name: foo notification
|
||||||
copy_from: email notification
|
copy_from: email notification
|
||||||
organization: Foo
|
organization: Foo
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_organization
|
module: organization
|
||||||
author: "Wayne Witzel III (@wwitzel3)"
|
author: "Wayne Witzel III (@wwitzel3)"
|
||||||
short_description: create, update, or destroy Ansible Tower organizations
|
short_description: create, update, or destroy Automation Controller organizations
|
||||||
description:
|
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.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
@@ -87,21 +87,21 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Create tower organization
|
- name: Create tower organization
|
||||||
tower_organization:
|
organization:
|
||||||
name: "Foo"
|
name: "Foo"
|
||||||
description: "Foo bar organization"
|
description: "Foo bar organization"
|
||||||
state: present
|
state: present
|
||||||
tower_config_file: "~/tower_cli.cfg"
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
- name: Create tower organization using 'foo-venv' as default Python virtualenv
|
- name: Create tower organization using 'foo-venv' as default Python virtualenv
|
||||||
tower_organization:
|
organization:
|
||||||
name: "Foo"
|
name: "Foo"
|
||||||
description: "Foo bar organization using foo-venv"
|
description: "Foo bar organization using foo-venv"
|
||||||
state: present
|
state: present
|
||||||
tower_config_file: "~/tower_cli.cfg"
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
- name: Create tower organization that pulls content from galaxy.ansible.com
|
- name: Create tower organization that pulls content from galaxy.ansible.com
|
||||||
tower_organization:
|
organization:
|
||||||
name: "Foo"
|
name: "Foo"
|
||||||
state: present
|
state: present
|
||||||
galaxy_credentials:
|
galaxy_credentials:
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_project
|
module: project
|
||||||
author: "Wayne Witzel III (@wwitzel3)"
|
author: "Wayne Witzel III (@wwitzel3)"
|
||||||
short_description: create, update, or destroy Ansible Tower projects
|
short_description: create, update, or destroy Automation Controller projects
|
||||||
description:
|
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.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
@@ -171,7 +171,7 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Add tower project
|
- name: Add tower project
|
||||||
tower_project:
|
project:
|
||||||
name: "Foo"
|
name: "Foo"
|
||||||
description: "Foo bar project"
|
description: "Foo bar project"
|
||||||
organization: "test"
|
organization: "test"
|
||||||
@@ -179,7 +179,7 @@ EXAMPLES = '''
|
|||||||
tower_config_file: "~/tower_cli.cfg"
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
- name: Add Tower Project with cache timeout
|
- name: Add Tower Project with cache timeout
|
||||||
tower_project:
|
project:
|
||||||
name: "Foo"
|
name: "Foo"
|
||||||
description: "Foo bar project"
|
description: "Foo bar project"
|
||||||
organization: "test"
|
organization: "test"
|
||||||
@@ -189,7 +189,7 @@ EXAMPLES = '''
|
|||||||
tower_config_file: "~/tower_cli.cfg"
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
- name: Copy tower project
|
- name: Copy tower project
|
||||||
tower_project:
|
project:
|
||||||
name: copy
|
name: copy
|
||||||
copy_from: test
|
copy_from: test
|
||||||
description: Foo copy project
|
description: Foo copy project
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_project_update
|
module: project_update
|
||||||
author: "Sean Sullivan (@sean-m-sullivan)"
|
author: "Sean Sullivan (@sean-m-sullivan)"
|
||||||
short_description: Update a Project in Ansible Tower
|
short_description: Update a Project in Automation Controller
|
||||||
description:
|
description:
|
||||||
- Update a Ansible Tower Project. See
|
- Update a Automation Controller Project. See
|
||||||
U(https://www.ansible.com/tower) for an overview.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
@@ -67,12 +67,12 @@ status:
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Launch a project with a timeout of 10 seconds
|
- name: Launch a project with a timeout of 10 seconds
|
||||||
tower_project_update:
|
project_update:
|
||||||
project: "Networking Project"
|
project: "Networking Project"
|
||||||
timeout: 10
|
timeout: 10
|
||||||
|
|
||||||
- name: Launch a Project with extra_vars without waiting
|
- name: Launch a Project with extra_vars without waiting
|
||||||
tower_project_update:
|
project_update:
|
||||||
project: "Networking Project"
|
project: "Networking Project"
|
||||||
wait: False
|
wait: False
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -14,15 +14,15 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['deprecated'], 'suppor
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_receive
|
module: receive
|
||||||
deprecated:
|
deprecated:
|
||||||
removed_in: "14.0.0"
|
removed_in: "14.0.0"
|
||||||
why: Deprecated in favor of upcoming C(_export) module.
|
why: Deprecated in favor of upcoming C(_export) module.
|
||||||
alternative: Once published, use M(tower_export) instead.
|
alternative: Once published, use M(tower_export) instead.
|
||||||
author: "John Westcott IV (@john-westcott-iv)"
|
author: "John Westcott IV (@john-westcott-iv)"
|
||||||
short_description: Receive assets from Ansible Tower.
|
short_description: Receive assets from Automation Controller.
|
||||||
description:
|
description:
|
||||||
- Receive assets from Ansible Tower. See
|
- Receive assets from Automation Controller. See
|
||||||
U(https://www.ansible.com/tower) for an overview.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
all:
|
all:
|
||||||
@@ -102,17 +102,17 @@ extends_documentation_fragment: awx.awx.auth_legacy
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Export all tower assets
|
- name: Export all tower assets
|
||||||
tower_receive:
|
receive:
|
||||||
all: True
|
all: True
|
||||||
tower_config_file: "~/tower_cli.cfg"
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
- name: Export all inventories
|
- name: Export all inventories
|
||||||
tower_receive:
|
receive:
|
||||||
inventory:
|
inventory:
|
||||||
- all
|
- all
|
||||||
|
|
||||||
- name: Export a job template named "My Template" and all Credentials
|
- name: Export a job template named "My Template" and all Credentials
|
||||||
tower_receive:
|
receive:
|
||||||
job_template:
|
job_template:
|
||||||
- "My Template"
|
- "My Template"
|
||||||
credential:
|
credential:
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_role
|
module: role
|
||||||
author: "Wayne Witzel III (@wwitzel3)"
|
author: "Wayne Witzel III (@wwitzel3)"
|
||||||
short_description: grant or revoke an Ansible Tower role.
|
short_description: grant or revoke an Automation Controller role.
|
||||||
description:
|
description:
|
||||||
- Roles are used for access control, this module is for managing user access to server resources.
|
- 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:
|
options:
|
||||||
user:
|
user:
|
||||||
description:
|
description:
|
||||||
@@ -131,14 +131,14 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Add jdoe to the member role of My Team
|
- name: Add jdoe to the member role of My Team
|
||||||
tower_role:
|
role:
|
||||||
user: jdoe
|
user: jdoe
|
||||||
target_team: "My Team"
|
target_team: "My Team"
|
||||||
role: member
|
role: member
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Add Joe to multiple job templates and a workflow
|
- name: Add Joe to multiple job templates and a workflow
|
||||||
tower_role:
|
role:
|
||||||
user: joe
|
user: joe
|
||||||
role: execute
|
role: execute
|
||||||
workflow: test-role-workflow
|
workflow: test-role-workflow
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_schedule
|
module: schedule
|
||||||
author: "John Westcott IV (@john-westcott-iv)"
|
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:
|
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.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
rrule:
|
rrule:
|
||||||
@@ -119,7 +119,7 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Build a schedule for Demo Job Template
|
- name: Build a schedule for Demo Job Template
|
||||||
tower_schedule:
|
schedule:
|
||||||
name: "{{ sched1 }}"
|
name: "{{ sched1 }}"
|
||||||
state: present
|
state: present
|
||||||
unified_job_template: "Demo Job Template"
|
unified_job_template: "Demo Job Template"
|
||||||
@@ -127,7 +127,7 @@ EXAMPLES = '''
|
|||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Build the same schedule using the rrule plugin
|
- name: Build the same schedule using the rrule plugin
|
||||||
tower_schedule:
|
schedule:
|
||||||
name: "{{ sched1 }}"
|
name: "{{ sched1 }}"
|
||||||
state: present
|
state: present
|
||||||
unified_job_template: "Demo Job Template"
|
unified_job_template: "Demo Job Template"
|
||||||
|
|||||||
@@ -14,15 +14,15 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['deprecated'], 'suppor
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_send
|
module: send
|
||||||
deprecated:
|
deprecated:
|
||||||
removed_in: "14.0.0"
|
removed_in: "14.0.0"
|
||||||
why: Deprecated in favor of upcoming C(_import) module.
|
why: Deprecated in favor of upcoming C(_import) module.
|
||||||
alternative: Once published, use M(tower_import) instead.
|
alternative: Once published, use M(tower_import) instead.
|
||||||
author: "John Westcott IV (@john-westcott-iv)"
|
author: "John Westcott IV (@john-westcott-iv)"
|
||||||
short_description: Send assets to Ansible Tower.
|
short_description: Send assets to Automation Controller.
|
||||||
description:
|
description:
|
||||||
- Send assets to Ansible Tower. See
|
- Send assets to Automation Controller. See
|
||||||
U(https://www.ansible.com/tower) for an overview.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
assets:
|
assets:
|
||||||
@@ -63,7 +63,7 @@ extends_documentation_fragment: awx.awx.auth_legacy
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Import all tower assets
|
- name: Import all tower assets
|
||||||
tower_send:
|
send:
|
||||||
assets: "{{ export_output.assets }}"
|
assets: "{{ export_output.assets }}"
|
||||||
tower_config_file: "~/tower_cli.cfg"
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_settings
|
module: settings
|
||||||
author: "Nikhil Jain (@jainnikhil30)"
|
author: "Nikhil Jain (@jainnikhil30)"
|
||||||
short_description: Modify Ansible Tower settings.
|
short_description: Modify Automation Controller settings.
|
||||||
description:
|
description:
|
||||||
- Modify Ansible Tower settings. See
|
- Modify Automation Controller settings. See
|
||||||
U(https://www.ansible.com/tower) for an overview.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
@@ -42,25 +42,25 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Set the value of AWX_ISOLATION_BASE_PATH
|
- name: Set the value of AWX_ISOLATION_BASE_PATH
|
||||||
tower_settings:
|
settings:
|
||||||
name: AWX_ISOLATION_BASE_PATH
|
name: AWX_ISOLATION_BASE_PATH
|
||||||
value: "/tmp"
|
value: "/tmp"
|
||||||
register: testing_settings
|
register: testing_settings
|
||||||
|
|
||||||
- name: Set the value of AWX_ISOLATION_SHOW_PATHS
|
- name: Set the value of AWX_ISOLATION_SHOW_PATHS
|
||||||
tower_settings:
|
settings:
|
||||||
name: "AWX_ISOLATION_SHOW_PATHS"
|
name: "AWX_ISOLATION_SHOW_PATHS"
|
||||||
value: "'/var/lib/awx/projects/', '/tmp'"
|
value: "'/var/lib/awx/projects/', '/tmp'"
|
||||||
register: testing_settings
|
register: testing_settings
|
||||||
|
|
||||||
- name: Set the LDAP Auth Bind Password
|
- name: Set the LDAP Auth Bind Password
|
||||||
tower_settings:
|
settings:
|
||||||
name: "AUTH_LDAP_BIND_PASSWORD"
|
name: "AUTH_LDAP_BIND_PASSWORD"
|
||||||
value: "Password"
|
value: "Password"
|
||||||
no_log: true
|
no_log: true
|
||||||
|
|
||||||
- name: Set all the LDAP Auth Bind Params
|
- name: Set all the LDAP Auth Bind Params
|
||||||
tower_settings:
|
settings:
|
||||||
settings:
|
settings:
|
||||||
AUTH_LDAP_BIND_PASSWORD: "password"
|
AUTH_LDAP_BIND_PASSWORD: "password"
|
||||||
AUTH_LDAP_USER_ATTR_MAP:
|
AUTH_LDAP_USER_ATTR_MAP:
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_team
|
module: team
|
||||||
author: "Wayne Witzel III (@wwitzel3)"
|
author: "Wayne Witzel III (@wwitzel3)"
|
||||||
short_description: create, update, or destroy Ansible Tower team.
|
short_description: create, update, or destroy Automation Controller team.
|
||||||
description:
|
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.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
@@ -51,7 +51,7 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Create tower team
|
- name: Create tower team
|
||||||
tower_team:
|
team:
|
||||||
name: Team Name
|
name: Team Name
|
||||||
description: Team Description
|
description: Team Description
|
||||||
organization: test-org
|
organization: test-org
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_token
|
module: token
|
||||||
author: "John Westcott IV (@john-westcott-iv)"
|
author: "John Westcott IV (@john-westcott-iv)"
|
||||||
version_added: "2.3"
|
version_added: "2.3"
|
||||||
short_description: create, update, or destroy Ansible Tower tokens.
|
short_description: create, update, or destroy Automation Controller tokens.
|
||||||
description:
|
description:
|
||||||
- Create or destroy Ansible Tower tokens. See
|
- Create or destroy Automation Controller tokens. See
|
||||||
U(https://www.ansible.com/tower) for an overview.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
- In addition, the module sets an Ansible fact which can be passed into other
|
- 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.
|
tower_* modules as the parameter tower_oauthtoken. See examples for usage.
|
||||||
@@ -66,19 +66,19 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- block:
|
- block:
|
||||||
- name: Create a new token using an existing token
|
- name: Create a new token using an existing token
|
||||||
tower_token:
|
token:
|
||||||
description: '{{ token_description }}'
|
description: '{{ token_description }}'
|
||||||
scope: "write"
|
scope: "write"
|
||||||
state: present
|
state: present
|
||||||
tower_oauthtoken: "{{ my_existing_token }}"
|
tower_oauthtoken: "{{ my_existing_token }}"
|
||||||
|
|
||||||
- name: Delete this token
|
- name: Delete this token
|
||||||
tower_token:
|
token:
|
||||||
existing_token: "{{ tower_token }}"
|
existing_token: "{{ tower_token }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Create a new token using username/password
|
- name: Create a new token using username/password
|
||||||
tower_token:
|
token:
|
||||||
description: '{{ token_description }}'
|
description: '{{ token_description }}'
|
||||||
scope: "write"
|
scope: "write"
|
||||||
state: present
|
state: present
|
||||||
@@ -86,24 +86,24 @@ EXAMPLES = '''
|
|||||||
tower_password: "{{ my_password }}"
|
tower_password: "{{ my_password }}"
|
||||||
|
|
||||||
- name: Use our new token to make another call
|
- name: Use our new token to make another call
|
||||||
tower_job_list:
|
job_list:
|
||||||
tower_oauthtoken: "{{ tower_token }}"
|
tower_oauthtoken: "{{ tower_token }}"
|
||||||
|
|
||||||
always:
|
always:
|
||||||
- name: Delete our Token with the token we created
|
- name: Delete our Token with the token we created
|
||||||
tower_token:
|
token:
|
||||||
existing_token: "{{ tower_token }}"
|
existing_token: "{{ tower_token }}"
|
||||||
state: absent
|
state: absent
|
||||||
when: tower_token is defined
|
when: tower_token is defined
|
||||||
|
|
||||||
- name: Delete a token by its id
|
- name: Delete a token by its id
|
||||||
tower_token:
|
token:
|
||||||
existing_token_id: 4
|
existing_token_id: 4
|
||||||
state: absent
|
state: absent
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
tower_token:
|
token:
|
||||||
type: dict
|
type: dict
|
||||||
description: An Ansible Fact variable representing a Tower token object which can be used for auth in subsequent modules. See examples for usage.
|
description: An Ansible Fact variable representing a Tower token object which can be used for auth in subsequent modules. See examples for usage.
|
||||||
contains:
|
contains:
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_user
|
module: user
|
||||||
author: "John Westcott IV (@john-westcott-iv)"
|
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:
|
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.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
username:
|
username:
|
||||||
@@ -72,7 +72,7 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Add tower user
|
- name: Add tower user
|
||||||
tower_user:
|
user:
|
||||||
username: jdoe
|
username: jdoe
|
||||||
password: foobarbaz
|
password: foobarbaz
|
||||||
email: jdoe@example.org
|
email: jdoe@example.org
|
||||||
@@ -82,7 +82,7 @@ EXAMPLES = '''
|
|||||||
tower_config_file: "~/tower_cli.cfg"
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
- name: Add tower user as a system administrator
|
- name: Add tower user as a system administrator
|
||||||
tower_user:
|
user:
|
||||||
username: jdoe
|
username: jdoe
|
||||||
password: foobarbaz
|
password: foobarbaz
|
||||||
email: jdoe@example.org
|
email: jdoe@example.org
|
||||||
@@ -91,7 +91,7 @@ EXAMPLES = '''
|
|||||||
tower_config_file: "~/tower_cli.cfg"
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
- name: Add tower user as a system auditor
|
- name: Add tower user as a system auditor
|
||||||
tower_user:
|
user:
|
||||||
username: jdoe
|
username: jdoe
|
||||||
password: foobarbaz
|
password: foobarbaz
|
||||||
email: jdoe@example.org
|
email: jdoe@example.org
|
||||||
@@ -100,7 +100,7 @@ EXAMPLES = '''
|
|||||||
tower_config_file: "~/tower_cli.cfg"
|
tower_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
- name: Delete tower user
|
- name: Delete tower user
|
||||||
tower_user:
|
user:
|
||||||
username: jdoe
|
username: jdoe
|
||||||
email: jdoe@example.org
|
email: jdoe@example.org
|
||||||
state: absent
|
state: absent
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ ANSIBLE_METADATA = {
|
|||||||
|
|
||||||
DOCUMENTATION = """
|
DOCUMENTATION = """
|
||||||
---
|
---
|
||||||
module: tower_workflow_approval
|
module: workflow_approval
|
||||||
author: "Sean Sullivan (@sean-m-sullivan)"
|
author: "Sean Sullivan (@sean-m-sullivan)"
|
||||||
short_description: Approve an approval node in a workflow job.
|
short_description: Approve an approval node in a workflow job.
|
||||||
description:
|
description:
|
||||||
@@ -58,13 +58,13 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
- name: Launch a workflow with a timeout of 10 seconds
|
- name: Launch a workflow with a timeout of 10 seconds
|
||||||
tower_workflow_launch:
|
workflow_launch:
|
||||||
workflow_template: "Test Workflow"
|
workflow_template: "Test Workflow"
|
||||||
wait: False
|
wait: False
|
||||||
register: workflow
|
register: workflow
|
||||||
|
|
||||||
- name: Wait for approval node to activate and approve
|
- name: Wait for approval node to activate and approve
|
||||||
tower_workflow_approval:
|
workflow_approval:
|
||||||
workflow_job_id: "{{ workflow.id }}"
|
workflow_job_id: "{{ workflow.id }}"
|
||||||
name: Approve Me
|
name: Approve Me
|
||||||
interval: 10
|
interval: 10
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_workflow_job_template
|
module: workflow_job_template
|
||||||
author: "John Westcott IV (@john-westcott-iv)"
|
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:
|
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.
|
- 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:
|
options:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
@@ -328,13 +328,13 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Create a workflow job template
|
- name: Create a workflow job template
|
||||||
tower_workflow_job_template:
|
workflow_job_template:
|
||||||
name: example-workflow
|
name: example-workflow
|
||||||
description: created by Ansible Playbook
|
description: created by Ansible Playbook
|
||||||
organization: Default
|
organization: Default
|
||||||
|
|
||||||
- name: Create a workflow job template with schema in template
|
- name: Create a workflow job template with schema in template
|
||||||
awx.awx.tower_workflow_job_template:
|
awx.awx.workflow_job_template:
|
||||||
name: example-workflow
|
name: example-workflow
|
||||||
inventory: Demo Inventory
|
inventory: Demo Inventory
|
||||||
extra_vars: {'foo': 'bar', 'another-foo': {'barz': 'bar2'}}
|
extra_vars: {'foo': 'bar', 'another-foo': {'barz': 'bar2'}}
|
||||||
@@ -391,13 +391,13 @@ EXAMPLES = '''
|
|||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Copy a workflow job template
|
- name: Copy a workflow job template
|
||||||
tower_workflow_job_template:
|
workflow_job_template:
|
||||||
name: copy-workflow
|
name: copy-workflow
|
||||||
copy_from: example-workflow
|
copy_from: example-workflow
|
||||||
organization: Foo
|
organization: Foo
|
||||||
|
|
||||||
- name: Create a workflow job template with schema in template
|
- name: Create a workflow job template with schema in template
|
||||||
awx.awx.tower_workflow_job_template:
|
awx.awx.workflow_job_template:
|
||||||
name: example-workflow
|
name: example-workflow
|
||||||
inventory: Demo Inventory
|
inventory: Demo Inventory
|
||||||
extra_vars: {'foo': 'bar', 'another-foo': {'barz': 'bar2'}}
|
extra_vars: {'foo': 'bar', 'another-foo': {'barz': 'bar2'}}
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_workflow_job_template_node
|
module: workflow_job_template_node
|
||||||
author: "John Westcott IV (@john-westcott-iv)"
|
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:
|
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.
|
- Use this to build a graph for a workflow, which dictates what the workflow runs.
|
||||||
- Replaces the deprecated tower_workflow_template module schema command.
|
- Replaces the deprecated tower_workflow_template module schema command.
|
||||||
- You can create nodes first, and link them afterwards, and not worry about ordering.
|
- 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 = '''
|
EXAMPLES = '''
|
||||||
- name: Create a node, follows tower_workflow_job_template example
|
- name: Create a node, follows tower_workflow_job_template example
|
||||||
tower_workflow_job_template_node:
|
workflow_job_template_node:
|
||||||
identifier: my-first-node
|
identifier: my-first-node
|
||||||
workflow: example-workflow
|
workflow: example-workflow
|
||||||
unified_job_template: jt-for-node-use
|
unified_job_template: jt-for-node-use
|
||||||
@@ -167,7 +167,7 @@ EXAMPLES = '''
|
|||||||
foo_key: bar_value
|
foo_key: bar_value
|
||||||
|
|
||||||
- name: Create parent node for prior node
|
- name: Create parent node for prior node
|
||||||
tower_workflow_job_template_node:
|
workflow_job_template_node:
|
||||||
identifier: my-root-node
|
identifier: my-root-node
|
||||||
workflow: example-workflow
|
workflow: example-workflow
|
||||||
unified_job_template: jt-for-node-use
|
unified_job_template: jt-for-node-use
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_workflow_launch
|
module: workflow_launch
|
||||||
author: "John Westcott IV (@john-westcott-iv)"
|
author: "John Westcott IV (@john-westcott-iv)"
|
||||||
short_description: Run a workflow in Ansible Tower
|
short_description: Run a workflow in Automation Controller
|
||||||
description:
|
description:
|
||||||
- Launch an Ansible Tower workflows. See
|
- Launch an Automation Controller workflows. See
|
||||||
U(https://www.ansible.com/tower) for an overview.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
@@ -77,12 +77,12 @@ job_info:
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: Launch a workflow with a timeout of 10 seconds
|
- name: Launch a workflow with a timeout of 10 seconds
|
||||||
tower_workflow_launch:
|
workflow_launch:
|
||||||
workflow_template: "Test Workflow"
|
workflow_template: "Test Workflow"
|
||||||
timeout: 10
|
timeout: 10
|
||||||
|
|
||||||
- name: Launch a Workflow with extra_vars without waiting
|
- name: Launch a Workflow with extra_vars without waiting
|
||||||
tower_workflow_launch:
|
workflow_launch:
|
||||||
workflow_template: "Test workflow"
|
workflow_template: "Test workflow"
|
||||||
extra_vars:
|
extra_vars:
|
||||||
var1: My First Variable
|
var1: My First Variable
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ ANSIBLE_METADATA = {
|
|||||||
|
|
||||||
DOCUMENTATION = """
|
DOCUMENTATION = """
|
||||||
---
|
---
|
||||||
module: tower_workflow_node_wait
|
module: workflow_node_wait
|
||||||
author: "Sean Sullivan (@sean-m-sullivan)"
|
author: "Sean Sullivan (@sean-m-sullivan)"
|
||||||
short_description: Approve an approval node in a workflow job.
|
short_description: Approve an approval node in a workflow job.
|
||||||
description:
|
description:
|
||||||
@@ -52,13 +52,13 @@ extends_documentation_fragment: awx.awx.auth
|
|||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
- name: Launch a workflow with a timeout of 10 seconds
|
- name: Launch a workflow with a timeout of 10 seconds
|
||||||
tower_workflow_launch:
|
workflow_launch:
|
||||||
workflow_template: "Test Workflow"
|
workflow_template: "Test Workflow"
|
||||||
wait: False
|
wait: False
|
||||||
register: workflow
|
register: workflow
|
||||||
|
|
||||||
- name: Wait for a workflow node to finish
|
- name: Wait for a workflow node to finish
|
||||||
tower_workflow_node_wait:
|
workflow_node_wait:
|
||||||
workflow_job_id: "{{ workflow.id }}"
|
workflow_job_id: "{{ workflow.id }}"
|
||||||
name: Approval Data Step
|
name: Approval Data Step
|
||||||
timeout: 120
|
timeout: 120
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ ANSIBLE_METADATA = {'status': ['deprecated'], 'supported_by': 'community', 'meta
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_workflow_template
|
module: workflow_template
|
||||||
deprecated:
|
deprecated:
|
||||||
removed_in: "14.0.0"
|
removed_in: "14.0.0"
|
||||||
why: Deprecated in favor of C(_workflow_job_template) and C(_workflow_job_template_node) modules.
|
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.
|
alternative: Use M(tower_workflow_job_template) and M(_workflow_job_template_node) instead.
|
||||||
author: "Adrien Fleury (@fleu42)"
|
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:
|
description:
|
||||||
- A tower-cli based module for CRUD actions on workflow job templates.
|
- A tower-cli based module for CRUD actions on workflow job templates.
|
||||||
- Enables use of the old schema functionality.
|
- Enables use of the old schema functionality.
|
||||||
@@ -92,13 +92,13 @@ extends_documentation_fragment: awx.awx.auth_legacy
|
|||||||
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- tower_workflow_template:
|
- workflow_template:
|
||||||
name: Workflow Template
|
name: Workflow Template
|
||||||
description: My very first Workflow Template
|
description: My very first Workflow Template
|
||||||
organization: My optional Organization
|
organization: My optional Organization
|
||||||
schema: "{{ lookup('file', 'my_workflow.json') }}"
|
schema: "{{ lookup('file', 'my_workflow.json') }}"
|
||||||
|
|
||||||
- tower_workflow_template:
|
- workflow_template:
|
||||||
name: Workflow Template
|
name: Workflow Template
|
||||||
state: absent
|
state: absent
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
pytz # for tower_schedule_rrule lookup plugin
|
pytz # for schedule_rrule lookup plugin
|
||||||
python-dateutil>=2.7.0 # tower_schedule_rrule
|
python-dateutil>=2.7.0 # schedule_rrule
|
||||||
awxkit # For import and export modules
|
awxkit # For import and export modules
|
||||||
@@ -11,7 +11,7 @@ from awx.main.models.ad_hoc_commands import AdHocCommand
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_ad_hoc_command_wait_successful(run_module, admin_user):
|
def test_ad_hoc_command_wait_successful(run_module, admin_user):
|
||||||
command = AdHocCommand.objects.create(status='successful', started=now(), finished=now())
|
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.pop('invocation', None)
|
||||||
result['elapsed'] = float(result['elapsed'])
|
result['elapsed'] = float(result['elapsed'])
|
||||||
assert result.pop('finished', '')[:10] == str(command.finished)[:10]
|
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
|
@pytest.mark.django_db
|
||||||
def test_ad_hoc_command_wait_failed(run_module, admin_user):
|
def test_ad_hoc_command_wait_failed(run_module, admin_user):
|
||||||
command = AdHocCommand.objects.create(status='failed', started=now(), finished=now())
|
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.pop('invocation', None)
|
||||||
result['elapsed'] = float(result['elapsed'])
|
result['elapsed'] = float(result['elapsed'])
|
||||||
assert result.pop('finished', '')[:10] == str(command.finished)[:10]
|
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
|
@pytest.mark.django_db
|
||||||
def test_ad_hoc_command_wait_not_found(run_module, admin_user):
|
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)
|
result.pop('invocation', None)
|
||||||
assert result == {"failed": True, "msg": "Unable to wait on ad hoc command 42; that ID does not exist in Tower."}
|
assert result == {"failed": True, "msg": "Unable to wait on ad hoc command 42; that ID does not exist in Tower."}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ def test_create_application(run_module, admin_user):
|
|||||||
'organization': 'foo',
|
'organization': 'foo',
|
||||||
}
|
}
|
||||||
|
|
||||||
result = run_module('tower_application', module_args, admin_user)
|
result = run_module('application', module_args, admin_user)
|
||||||
assert result.get('changed'), result
|
assert result.get('changed'), result
|
||||||
|
|
||||||
application = OAuth2Application.objects.get(name='foo_app')
|
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
|
# Normally a read-only endpoint should not have a module (i.e. /api/v2/me) but sometimes we reuse a name
|
||||||
# For example, we have a tower_role module but /api/v2/roles is a read only endpoint.
|
# For example, we have a tower_role module but /api/v2/roles is a read only endpoint.
|
||||||
# This list indicates which read-only endpoints have associated modules with them.
|
# 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
|
# 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
|
# 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
|
# Some modules work on the related fields of an endpoint. These modules will not have an auto-associated endpoint
|
||||||
no_endpoint_for_module = [
|
no_endpoint_for_module = [
|
||||||
'tower_import',
|
'import',
|
||||||
'tower_meta',
|
'meta',
|
||||||
'tower_export',
|
'export',
|
||||||
'tower_inventory_source_update',
|
'inventory_source_update',
|
||||||
'tower_job_launch',
|
'job_launch',
|
||||||
'tower_job_wait',
|
'job_wait',
|
||||||
'tower_job_list',
|
'job_list',
|
||||||
'tower_license',
|
'license',
|
||||||
'tower_ping',
|
'ping',
|
||||||
'tower_receive',
|
'receive',
|
||||||
'tower_send',
|
'send',
|
||||||
'tower_workflow_launch',
|
'workflow_launch',
|
||||||
'tower_workflow_node_wait',
|
'workflow_node_wait',
|
||||||
'tower_job_cancel',
|
'job_cancel',
|
||||||
'tower_workflow_template',
|
'workflow_template',
|
||||||
'tower_ad_hoc_command_wait',
|
'ad_hoc_command_wait',
|
||||||
'tower_ad_hoc_command_cancel',
|
'ad_hoc_command_cancel',
|
||||||
]
|
]
|
||||||
|
|
||||||
# Global module parameters we can ignore
|
# 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
|
# Add the module name as the key with the value being the list of params to ignore
|
||||||
no_api_parameter_ok = {
|
no_api_parameter_ok = {
|
||||||
# The wait is for whether or not to wait for a project update on change
|
# 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
|
# 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
|
# /survey spec is now how we handle associations
|
||||||
# We take an organization here to help with the lookups only
|
# We take an organization here to help with the lookups only
|
||||||
'tower_job_template': ['survey_spec', 'organization'],
|
'job_template': ['survey_spec', 'organization'],
|
||||||
'tower_inventory_source': ['organization'],
|
'inventory_source': ['organization'],
|
||||||
# Organization is how we are looking up job templates, Approval node is for workflow_approval_templates
|
# 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
|
# 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
|
# 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 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 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
|
# 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
|
# 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.
|
# 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 = {
|
needs_param_development = {
|
||||||
'tower_host': ['instance_id'],
|
'host': ['instance_id'],
|
||||||
'tower_workflow_approval': ['description', 'execution_environment'],
|
'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]
|
singular_endpoint = singular_endpoint[:-3]
|
||||||
if singular_endpoint != 'settings' and singular_endpoint.endswith('s'):
|
if singular_endpoint != 'settings' and singular_endpoint.endswith('s'):
|
||||||
singular_endpoint = singular_endpoint[:-1]
|
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)
|
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 = CredentialType.defaults['ssh']()
|
||||||
ct.save()
|
ct.save()
|
||||||
# Example from docs
|
# 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 not result.get('failed', False), result.get('msg', result)
|
||||||
assert result.get('changed'), result
|
assert result.get('changed'), result
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ def test_create_vault_credential(run_module, admin_user, organization, silence_d
|
|||||||
ct.save()
|
ct.save()
|
||||||
|
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_credential',
|
'credential',
|
||||||
dict(name='Test Vault Credential', organization=organization.name, kind='vault', vault_id='bar', vault_password='foobar', state='present'),
|
dict(name='Test Vault Credential', organization=organization.name, kind='vault', vault_id='bar', vault_password='foobar', state='present'),
|
||||||
admin_user,
|
admin_user,
|
||||||
)
|
)
|
||||||
@@ -67,7 +67,7 @@ def test_create_vault_credential(run_module, admin_user, organization, silence_d
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_ct_precedence_over_kind(run_module, admin_user, organization, cred_type, silence_deprecation):
|
def test_ct_precedence_over_kind(run_module, admin_user, organization, cred_type, silence_deprecation):
|
||||||
result = run_module(
|
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)
|
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 = CredentialType.defaults['vault']()
|
||||||
ct.save()
|
ct.save()
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_credential',
|
'credential',
|
||||||
dict(
|
dict(
|
||||||
name='A Vault credential',
|
name='A Vault credential',
|
||||||
organization=organization.name,
|
organization=organization.name,
|
||||||
@@ -103,7 +103,7 @@ def test_input_overrides_old_fields(run_module, admin_user, organization, silenc
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_missing_credential_type(run_module, admin_user, organization):
|
def test_missing_credential_type(run_module, admin_user, organization):
|
||||||
Organization.objects.create(name='test-org')
|
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 result.get('failed', False), result
|
||||||
assert 'credential_type' in result['msg']
|
assert 'credential_type' in result['msg']
|
||||||
assert 'foobar' 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
|
@pytest.mark.django_db
|
||||||
def test_make_use_of_custom_credential_type(run_module, organization, admin_user, cred_type):
|
def test_make_use_of_custom_credential_type(run_module, organization, admin_user, cred_type):
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_credential',
|
'credential',
|
||||||
dict(name='Galaxy Token for Steve', organization=organization.name, credential_type=cred_type.name, inputs={'token': '7rEZK38DJl58A7RxA6EC7lLvUHbBQ1'}),
|
dict(name='Galaxy Token for Steve', organization=organization.name, credential_type=cred_type.name, inputs={'token': '7rEZK38DJl58A7RxA6EC7lLvUHbBQ1'}),
|
||||||
admin_user,
|
admin_user,
|
||||||
)
|
)
|
||||||
@@ -137,7 +137,7 @@ def test_secret_field_write_twice(run_module, organization, admin_user, cred_typ
|
|||||||
val2 = '7rEZ238DJl5837rxA6xxxlLvUHbBQ1'
|
val2 = '7rEZ238DJl5837rxA6xxxlLvUHbBQ1'
|
||||||
for val in (val1, val2):
|
for val in (val1, val2):
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_credential',
|
'credential',
|
||||||
dict(
|
dict(
|
||||||
name='Galaxy Token for Steve',
|
name='Galaxy Token for Steve',
|
||||||
organization=organization.name,
|
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'})
|
tgt_cred = Credential.objects.create(name='Test Machine Credential', organization=organization, credential_type=ct, inputs={'username': 'bob'})
|
||||||
|
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_credential_input_source',
|
'credential_input_source',
|
||||||
dict(
|
dict(
|
||||||
source_credential=source_cred_aim.name,
|
source_credential=source_cred_aim.name,
|
||||||
target_credential=tgt_cred.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'})
|
tgt_cred = Credential.objects.create(name='Test Machine Credential', organization=organization, credential_type=ct, inputs={'username': 'bob'})
|
||||||
|
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_credential_input_source',
|
'credential_input_source',
|
||||||
dict(
|
dict(
|
||||||
source_credential=source_cred_conjur.name,
|
source_credential=source_cred_conjur.name,
|
||||||
target_credential=tgt_cred.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'})
|
tgt_cred = Credential.objects.create(name='Test Machine Credential', organization=organization, credential_type=ct, inputs={'username': 'bob'})
|
||||||
|
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_credential_input_source',
|
'credential_input_source',
|
||||||
dict(
|
dict(
|
||||||
source_credential=source_cred_hashi_secret.name,
|
source_credential=source_cred_hashi_secret.name,
|
||||||
target_credential=tgt_cred.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'})
|
tgt_cred = Credential.objects.create(name='Test Machine Credential', organization=organization, credential_type=ct, inputs={'username': 'bob'})
|
||||||
|
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_credential_input_source',
|
'credential_input_source',
|
||||||
dict(
|
dict(
|
||||||
source_credential=source_cred_hashi_ssh.name,
|
source_credential=source_cred_hashi_ssh.name,
|
||||||
target_credential=tgt_cred.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'})
|
tgt_cred = Credential.objects.create(name='Test Machine Credential', organization=organization, credential_type=ct, inputs={'username': 'bob'})
|
||||||
|
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_credential_input_source',
|
'credential_input_source',
|
||||||
dict(
|
dict(
|
||||||
source_credential=source_cred_azure_kv.name,
|
source_credential=source_cred_azure_kv.name,
|
||||||
target_credential=tgt_cred.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'})
|
tgt_cred = Credential.objects.create(name='Test Machine Credential', organization=organization, credential_type=ct, inputs={'username': 'bob'})
|
||||||
|
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_credential_input_source',
|
'credential_input_source',
|
||||||
dict(
|
dict(
|
||||||
source_credential=source_cred_aim.name,
|
source_credential=source_cred_aim.name,
|
||||||
target_credential=tgt_cred.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
|
assert result.get('changed'), result
|
||||||
|
|
||||||
unchangedResult = run_module(
|
unchangedResult = run_module(
|
||||||
'tower_credential_input_source',
|
'credential_input_source',
|
||||||
dict(
|
dict(
|
||||||
source_credential=source_cred_aim.name,
|
source_credential=source_cred_aim.name,
|
||||||
target_credential=tgt_cred.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
|
assert not unchangedResult.get('changed'), result
|
||||||
|
|
||||||
changedResult = run_module(
|
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'),
|
dict(source_credential=source_cred_aim_alt.name, target_credential=tgt_cred.name, input_field_name='password', state='present'),
|
||||||
admin_user,
|
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'})
|
tgt_cred = Credential.objects.create(name='Test Machine Credential', organization=organization, credential_type=ct, inputs={'username': 'bob'})
|
||||||
|
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_credential_input_source',
|
'credential_input_source',
|
||||||
dict(
|
dict(
|
||||||
source_credential=source_cred_centrify_secret.name,
|
source_credential=source_cred_centrify_secret.name,
|
||||||
target_credential=tgt_cred.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):
|
def test_create_custom_credential_type(run_module, admin_user, silence_deprecation):
|
||||||
# Example from docs
|
# Example from docs
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_credential_type',
|
'credential_type',
|
||||||
dict(
|
dict(
|
||||||
name='Nexus',
|
name='Nexus',
|
||||||
description='Credentials type for 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
|
@pytest.mark.django_db
|
||||||
def test_changed_false_with_api_changes(run_module, admin_user):
|
def test_changed_false_with_api_changes(run_module, admin_user):
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_credential_type',
|
'credential_type',
|
||||||
dict(
|
dict(
|
||||||
name='foo',
|
name='foo',
|
||||||
kind='cloud',
|
kind='cloud',
|
||||||
@@ -50,7 +50,7 @@ def test_changed_false_with_api_changes(run_module, admin_user):
|
|||||||
assert result.get('changed'), result
|
assert result.get('changed'), result
|
||||||
|
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_credential_type',
|
'credential_type',
|
||||||
dict(
|
dict(
|
||||||
name='foo',
|
name='foo',
|
||||||
inputs={"fields": [{"id": "env_value", "label": "foo", "default": "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)
|
inv = Inventory.objects.create(name='test-inv', organization=org)
|
||||||
variables = {"ansible_network_os": "iosxr"}
|
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
|
assert result.get('changed'), result
|
||||||
|
|
||||||
group = Group.objects.get(name='Test Group')
|
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')
|
child = Group.objects.create(inventory=inv, name='child_group')
|
||||||
|
|
||||||
result = run_module(
|
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'),
|
dict(name='Test Group', inventory='test-inv', hosts=[inv_hosts[1].name, inv_hosts[2].name], children=[child.name], state='present'),
|
||||||
admin_user,
|
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)
|
child = Group.objects.create(name='test-child', inventory=inv)
|
||||||
host = Host.objects.create(name='test-host', 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 not result.get('failed', False), result.get('msg', result)
|
||||||
assert result['changed'] is True
|
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)
|
inv = Inventory.objects.create(name='test-inv', organization=organization)
|
||||||
group = Group.objects.create(name='Test Group', inventory=inv)
|
group = Group.objects.create(name='Test Group', inventory=inv)
|
||||||
child = Group.objects.create(inventory=inv, name='child_group')
|
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 not result.get('failed', False), result.get('msg', result)
|
||||||
assert result['changed'] is True
|
assert result['changed'] is True
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ def test_tower_group_idempotent(run_module, admin_user):
|
|||||||
inventory=inv,
|
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')
|
result.pop('invocation')
|
||||||
assert result == {
|
assert result == {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from awx.main.tests.functional.conftest import kube_credential, credentialtype_k
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_instance_group_create(run_module, admin_user):
|
def test_instance_group_create(run_module, admin_user):
|
||||||
result = run_module(
|
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 not result.get('failed', False), result
|
||||||
assert result['changed']
|
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')
|
new_instance = Instance.objects.create(hostname='foo.example.com')
|
||||||
|
|
||||||
# Set the new instance group only to the one instnace
|
# 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 not result.get('failed', False), result
|
||||||
assert result['changed']
|
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):
|
def test_container_group_create(run_module, admin_user, kube_credential):
|
||||||
pod_spec = "{ 'Nothing': True }"
|
pod_spec = "{ 'Nothing': True }"
|
||||||
|
|
||||||
result = run_module(
|
result = run_module('instance_group', {'name': 'foo-c-group', 'credential': kube_credential.id, 'is_container_group': True, 'state': 'present'}, admin_user)
|
||||||
'tower_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 not result.get('failed', False), result['msg']
|
||||||
assert result['changed']
|
assert result['changed']
|
||||||
|
|
||||||
@@ -51,7 +49,7 @@ def test_container_group_create(run_module, admin_user, kube_credential):
|
|||||||
assert ig.pod_spec_override == ''
|
assert ig.pod_spec_override == ''
|
||||||
|
|
||||||
result = run_module(
|
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'},
|
{'name': 'foo-c-group', 'credential': kube_credential.id, 'is_container_group': True, 'pod_spec_override': pod_spec, 'state': 'present'},
|
||||||
admin_user,
|
admin_user,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ def test_inventory_create(run_module, admin_user, organization, insights_credent
|
|||||||
# Create an insights credential
|
# Create an insights credential
|
||||||
|
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_inventory',
|
'inventory',
|
||||||
{
|
{
|
||||||
'name': 'foo-inventory',
|
'name': 'foo-inventory',
|
||||||
'organization': organization.name,
|
'organization': organization.name,
|
||||||
@@ -39,7 +39,7 @@ def test_inventory_create(run_module, admin_user, organization, insights_credent
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_invalid_smart_inventory_create(run_module, admin_user, organization):
|
def test_invalid_smart_inventory_create(run_module, admin_user, organization):
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_inventory',
|
'inventory',
|
||||||
{'name': 'foo-inventory', 'organization': organization.name, 'kind': 'smart', 'host_filter': 'ansible', 'state': 'present'},
|
{'name': 'foo-inventory', 'organization': organization.name, 'kind': 'smart', 'host_filter': 'ansible', 'state': 'present'},
|
||||||
admin_user,
|
admin_user,
|
||||||
)
|
)
|
||||||
@@ -51,7 +51,7 @@ def test_invalid_smart_inventory_create(run_module, admin_user, organization):
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_valid_smart_inventory_create(run_module, admin_user, organization):
|
def test_valid_smart_inventory_create(run_module, admin_user, organization):
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_inventory',
|
'inventory',
|
||||||
{'name': 'foo-inventory', 'organization': organization.name, 'kind': 'smart', 'host_filter': 'name=my_host', 'state': 'present'},
|
{'name': 'foo-inventory', 'organization': organization.name, 'kind': 'smart', 'host_filter': 'name=my_host', 'state': 'present'},
|
||||||
admin_user,
|
admin_user,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ def project(base_inventory):
|
|||||||
def test_inventory_source_create(run_module, admin_user, base_inventory, project):
|
def test_inventory_source_create(run_module, admin_user, base_inventory, project):
|
||||||
source_path = '/var/lib/awx/example_source_path/'
|
source_path = '/var/lib/awx/example_source_path/'
|
||||||
result = run_module(
|
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),
|
dict(name='foo', inventory=base_inventory.name, state='present', source='scm', source_path=source_path, source_project=project.name),
|
||||||
admin_user,
|
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)
|
inv = Inventory.objects.create(name='test-inv', organization=org)
|
||||||
|
|
||||||
# Credential is not required for ec2 source, because of IAM roles
|
# 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
|
assert result.pop('changed', None), result
|
||||||
|
|
||||||
inv_src = InventorySource.objects.get(name='Test Inventory Source')
|
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)
|
inv2 = Inventory.objects.create(name='test-inv', organization=org2)
|
||||||
|
|
||||||
result = run_module(
|
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'),
|
dict(name='Test Inventory Source', inventory=inv2.name, organization='test-org-number-two', source='ec2', state='present'),
|
||||||
admin_user,
|
admin_user,
|
||||||
)
|
)
|
||||||
@@ -90,14 +90,14 @@ def test_create_inventory_source_multiple_orgs(run_module, admin_user):
|
|||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_falsy_value(run_module, admin_user, base_inventory):
|
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 not result.get('failed', False), result.get('msg', result)
|
||||||
assert result.get('changed', None), result
|
assert result.get('changed', None), result
|
||||||
|
|
||||||
inv_src = InventorySource.objects.get(name='falsy-test')
|
inv_src = InventorySource.objects.get(name='falsy-test')
|
||||||
assert inv_src.update_on_launch is True
|
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()
|
inv_src.refresh_from_db()
|
||||||
assert inv_src.update_on_launch is False
|
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
|
@pytest.mark.django_db
|
||||||
def test_missing_required_credential(run_module, admin_user, base_inventory):
|
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 result.pop('failed', None) is True, result
|
||||||
|
|
||||||
assert 'Credential is required for a cloud source' in result.get('msg', '')
|
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
|
@pytest.mark.django_db
|
||||||
def test_source_project_not_for_cloud(run_module, admin_user, base_inventory, project):
|
def test_source_project_not_for_cloud(run_module, admin_user, base_inventory, project):
|
||||||
result = run_module(
|
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),
|
dict(name='Test ec2 Inventory Source', inventory=base_inventory.name, source='ec2', state='present', source_project=project.name),
|
||||||
admin_user,
|
admin_user,
|
||||||
)
|
)
|
||||||
@@ -148,7 +148,7 @@ def test_source_project_not_for_cloud(run_module, admin_user, base_inventory, pr
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_source_path_not_for_cloud(run_module, admin_user, base_inventory):
|
def test_source_path_not_for_cloud(run_module, admin_user, base_inventory):
|
||||||
result = run_module(
|
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'),
|
dict(name='Test ec2 Inventory Source', inventory=base_inventory.name, source='ec2', state='present', source_path='where/am/I'),
|
||||||
admin_user,
|
admin_user,
|
||||||
)
|
)
|
||||||
@@ -160,7 +160,7 @@ def test_source_path_not_for_cloud(run_module, admin_user, base_inventory):
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_scm_source_needs_project(run_module, admin_user, base_inventory):
|
def test_scm_source_needs_project(run_module, admin_user, base_inventory):
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_inventory_source',
|
'inventory_source',
|
||||||
dict(
|
dict(
|
||||||
name='SCM inventory without project', inventory=base_inventory.name, state='present', source='scm', source_path='/var/lib/awx/example_source_path/'
|
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
|
@pytest.mark.django_db
|
||||||
def test_job_wait_successful(run_module, admin_user):
|
def test_job_wait_successful(run_module, admin_user):
|
||||||
job = Job.objects.create(status='successful', started=now(), finished=now())
|
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.pop('invocation', None)
|
||||||
result['elapsed'] = float(result['elapsed'])
|
result['elapsed'] = float(result['elapsed'])
|
||||||
assert result.pop('finished', '')[:10] == str(job.finished)[:10]
|
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
|
@pytest.mark.django_db
|
||||||
def test_job_wait_failed(run_module, admin_user):
|
def test_job_wait_failed(run_module, admin_user):
|
||||||
job = Job.objects.create(status='failed', started=now(), finished=now())
|
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.pop('invocation', None)
|
||||||
result['elapsed'] = float(result['elapsed'])
|
result['elapsed'] = float(result['elapsed'])
|
||||||
assert result.pop('finished', '')[:10] == str(job.finished)[:10]
|
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
|
@pytest.mark.django_db
|
||||||
def test_job_wait_not_found(run_module, admin_user):
|
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)
|
result.pop('invocation', None)
|
||||||
assert result == {"failed": True, "msg": "Unable to wait on job 42; that ID does not exist in Tower."}
|
assert result == {"failed": True, "msg": "Unable to wait on job 42; that ID does not exist in Tower."}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ def test_create_job_template(run_module, admin_user, project, inventory):
|
|||||||
'state': 'present',
|
'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')
|
jt = JobTemplate.objects.get(name='foo')
|
||||||
assert jt.extra_vars == '{"foo": "bar"}'
|
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,
|
'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')
|
jt = JobTemplate.objects.get(name='foo')
|
||||||
assert jt.forks == 20
|
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,
|
'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']
|
assert result['changed']
|
||||||
|
|
||||||
jt = JobTemplate.objects.get(name='foo')
|
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,
|
ask_credential_on_launch=True,
|
||||||
)
|
)
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_job_launch',
|
'job_launch',
|
||||||
dict(
|
dict(
|
||||||
job_template='foo',
|
job_template='foo',
|
||||||
inventory=inventory.name,
|
inventory=inventory.name,
|
||||||
@@ -112,7 +112,7 @@ def test_job_launch_with_prompting(run_module, admin_user, project, organization
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_job_template_with_new_credentials(run_module, admin_user, project, inventory, machine_credential, vault_credential):
|
def test_job_template_with_new_credentials(run_module, admin_user, project, inventory, machine_credential, vault_credential):
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_job_template',
|
'job_template',
|
||||||
dict(
|
dict(
|
||||||
name='foo', playbook='helloworld.yml', project=project.name, inventory=inventory.name, credentials=[machine_credential.name, vault_credential.name]
|
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()
|
prior_ct = ActivityStream.objects.count()
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_job_template',
|
'job_template',
|
||||||
dict(
|
dict(
|
||||||
name='foo', playbook='helloworld.yml', project=project.name, inventory=inventory.name, credentials=[machine_credential.name, vault_credential.name]
|
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
|
@pytest.mark.django_db
|
||||||
def test_job_template_with_survey_spec(run_module, admin_user, project, inventory, survey_spec):
|
def test_job_template_with_survey_spec(run_module, admin_user, project, inventory, survey_spec):
|
||||||
result = run_module(
|
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),
|
dict(name='foo', playbook='helloworld.yml', project=project.name, inventory=inventory.name, survey_spec=survey_spec, survey_enabled=True),
|
||||||
admin_user,
|
admin_user,
|
||||||
)
|
)
|
||||||
@@ -156,7 +156,7 @@ def test_job_template_with_survey_spec(run_module, admin_user, project, inventor
|
|||||||
|
|
||||||
prior_ct = ActivityStream.objects.count()
|
prior_ct = ActivityStream.objects.count()
|
||||||
result = run_module(
|
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),
|
dict(name='foo', playbook='helloworld.yml', project=project.name, inventory=inventory.name, survey_spec=survey_spec, survey_enabled=True),
|
||||||
admin_user,
|
admin_user,
|
||||||
)
|
)
|
||||||
@@ -172,7 +172,7 @@ def test_job_template_with_survey_spec(run_module, admin_user, project, inventor
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_job_template_with_wrong_survey_spec(run_module, admin_user, project, inventory, survey_spec):
|
def test_job_template_with_wrong_survey_spec(run_module, admin_user, project, inventory, survey_spec):
|
||||||
result = run_module(
|
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),
|
dict(name='foo', playbook='helloworld.yml', project=project.name, inventory=inventory.name, survey_spec=survey_spec, survey_enabled=True),
|
||||||
admin_user,
|
admin_user,
|
||||||
)
|
)
|
||||||
@@ -187,7 +187,7 @@ def test_job_template_with_wrong_survey_spec(run_module, admin_user, project, in
|
|||||||
del survey_spec['description']
|
del survey_spec['description']
|
||||||
|
|
||||||
result = run_module(
|
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),
|
dict(name='foo', playbook='helloworld.yml', project=project.name, inventory=inventory.name, survey_spec=survey_spec, survey_enabled=True),
|
||||||
admin_user,
|
admin_user,
|
||||||
)
|
)
|
||||||
@@ -204,7 +204,7 @@ def test_job_template_with_survey_encrypted_default(run_module, admin_user, proj
|
|||||||
}
|
}
|
||||||
for i in range(2):
|
for i in range(2):
|
||||||
result = run_module(
|
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),
|
dict(name='foo', playbook='helloworld.yml', project=project.name, inventory=inventory.name, survey_spec=spec, survey_enabled=True),
|
||||||
admin_user,
|
admin_user,
|
||||||
)
|
)
|
||||||
@@ -236,9 +236,7 @@ def test_associate_only_on_success(run_module, admin_user, organization, project
|
|||||||
jt.notification_templates_error.add(nt1)
|
jt.notification_templates_error.add(nt1)
|
||||||
|
|
||||||
# test preservation of error NTs when success NTs are added
|
# test preservation of error NTs when success NTs are added
|
||||||
result = run_module(
|
result = run_module('job_template', dict(name='foo', playbook='helloworld.yml', project=project.name, notification_templates_success=['nt2']), admin_user)
|
||||||
'tower_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 not result.get('failed', False), result.get('msg', result)
|
||||||
assert result.get('changed', True), 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]
|
assert list(jt.notification_templates_error.values_list('id', flat=True)) == [nt1.id]
|
||||||
|
|
||||||
# test removal to empty list
|
# 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 not result.get('failed', False), result.get('msg', result)
|
||||||
assert result.get('changed', True), result
|
assert result.get('changed', True), result
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from awx.main.models import Label
|
|||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_create_label(run_module, admin_user, organization):
|
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 not result.get('failed'), result.get('msg', result)
|
||||||
assert result.get('changed', False)
|
assert result.get('changed', False)
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ def test_create_label(run_module, admin_user, organization):
|
|||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_create_label_using_org_id(run_module, admin_user, organization):
|
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 not result.get('failed'), result.get('msg', result)
|
||||||
assert result.get('changed', False)
|
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):
|
def test_modify_label(run_module, admin_user, organization):
|
||||||
label = Label.objects.create(name='test-label', organization=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 not result.get('failed'), result.get('msg', result)
|
||||||
assert result.get('changed', False)
|
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):
|
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': {}}
|
cli_data = {'ANSIBLE_MODULE_ARGS': {}}
|
||||||
testargs = ['module_file2.py', json.dumps(cli_data)]
|
testargs = ['module_file2.py', json.dumps(cli_data)]
|
||||||
with mock.patch.object(sys, 'argv', testargs):
|
with mock.patch.object(sys, 'argv', testargs):
|
||||||
with mock.patch('ansible.module_utils.urls.Request.open', new=mock_awx_ping_response):
|
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_VERSION = "2.0.0"
|
||||||
my_module._COLLECTION_TYPE = "awx"
|
my_module._COLLECTION_TYPE = "awx"
|
||||||
my_module.get_endpoint('ping')
|
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):
|
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': {}}
|
cli_data = {'ANSIBLE_MODULE_ARGS': {}}
|
||||||
testargs = ['module_file2.py', json.dumps(cli_data)]
|
testargs = ['module_file2.py', json.dumps(cli_data)]
|
||||||
# Compare 1.0.0 to 1.2.3 (major matches)
|
# Compare 1.0.0 to 1.2.3 (major matches)
|
||||||
with mock.patch.object(sys, 'argv', testargs):
|
with mock.patch.object(sys, 'argv', testargs):
|
||||||
with mock.patch('ansible.module_utils.urls.Request.open', new=mock_awx_ping_response):
|
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_VERSION = "1.0.0"
|
||||||
my_module._COLLECTION_TYPE = "awx"
|
my_module._COLLECTION_TYPE = "awx"
|
||||||
my_module.get_endpoint('ping')
|
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)
|
# Compare 1.2.0 to 1.2.3 (major matches minor does not count)
|
||||||
with mock.patch.object(sys, 'argv', testargs):
|
with mock.patch.object(sys, 'argv', testargs):
|
||||||
with mock.patch('ansible.module_utils.urls.Request.open', new=mock_awx_ping_response):
|
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_VERSION = "1.2.0"
|
||||||
my_module._COLLECTION_TYPE = "awx"
|
my_module._COLLECTION_TYPE = "awx"
|
||||||
my_module.get_endpoint('ping')
|
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):
|
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': {}}
|
cli_data = {'ANSIBLE_MODULE_ARGS': {}}
|
||||||
testargs = ['module_file2.py', json.dumps(cli_data)]
|
testargs = ['module_file2.py', json.dumps(cli_data)]
|
||||||
# Compare 1.2.0 to 1.2.3 (major/minor matches)
|
# Compare 1.2.0 to 1.2.3 (major/minor matches)
|
||||||
with mock.patch.object(sys, 'argv', testargs):
|
with mock.patch.object(sys, 'argv', testargs):
|
||||||
with mock.patch('ansible.module_utils.urls.Request.open', new=mock_tower_ping_response):
|
with mock.patch('ansible.module_utils.urls.Request.open', new=mock_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_VERSION = "1.2.0"
|
||||||
my_module._COLLECTION_TYPE = "tower"
|
my_module._COLLECTION_TYPE = "tower"
|
||||||
my_module.get_endpoint('ping')
|
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)
|
# Compare 1.0.0 to 1.2.3 (major/minor fail to match)
|
||||||
with mock.patch.object(sys, 'argv', testargs):
|
with mock.patch.object(sys, 'argv', testargs):
|
||||||
with mock.patch('ansible.module_utils.urls.Request.open', new=mock_tower_ping_response):
|
with mock.patch('ansible.module_utils.urls.Request.open', new=mock_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_VERSION = "1.0.0"
|
||||||
my_module._COLLECTION_TYPE = "tower"
|
my_module._COLLECTION_TYPE = "tower"
|
||||||
my_module.get_endpoint('ping')
|
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):
|
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': {}}
|
cli_data = {'ANSIBLE_MODULE_ARGS': {}}
|
||||||
testargs = ['module_file2.py', json.dumps(cli_data)]
|
testargs = ['module_file2.py', json.dumps(cli_data)]
|
||||||
with mock.patch.object(sys, 'argv', testargs):
|
with mock.patch.object(sys, 'argv', testargs):
|
||||||
with mock.patch('ansible.module_utils.urls.Request.open', new=mock_awx_ping_response):
|
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_VERSION = ping_version
|
||||||
my_module._COLLECTION_TYPE = "tower"
|
my_module._COLLECTION_TYPE = "tower"
|
||||||
my_module.get_endpoint('ping')
|
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):
|
def test_duplicate_config(collection_import, silence_warning):
|
||||||
# imports done here because of PATH issues unique to this test suite
|
# 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'}
|
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(
|
argument_spec = dict(
|
||||||
name=dict(required=True),
|
name=dict(required=True),
|
||||||
zig=dict(type='str'),
|
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')
|
assert mock_load.mock_calls[-1] == mock.call('my_config')
|
||||||
|
|
||||||
silence_warning.assert_called_once_with(
|
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
|
Those replacements should happen at build time, so they should not be
|
||||||
checked into source.
|
checked into source.
|
||||||
"""
|
"""
|
||||||
TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule
|
ControllerAPIModule = collection_import('plugins.module_utils.controller_api').ControllerAPIModule
|
||||||
assert TowerAPIModule._COLLECTION_VERSION == "0.0.1-devel", (
|
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".'
|
'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', (
|
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.'
|
'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')
|
org_by_id = Organization.objects.create(name='foo')
|
||||||
slug = str(org_by_id.id)
|
slug = str(org_by_id.id)
|
||||||
org_by_name = Organization.objects.create(name=slug)
|
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)
|
assert not result.get('failed', False), result.get('msg', result)
|
||||||
team = Team.objects.filter(name='foo_team').first()
|
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.'
|
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_type='git',
|
||||||
scm_url="https://github.com/ansible/ansible-tower-samples",
|
scm_url="https://github.com/ansible/ansible-tower-samples",
|
||||||
)
|
)
|
||||||
result = run_module(
|
result = run_module('job_template', {'name': 'Demo Job Template', 'project': proj1.name, 'inventory': inv.id, 'playbook': 'hello_world.yml'}, admin_user)
|
||||||
'tower_job_template', {'name': 'Demo Job Template', 'project': proj1.name, 'inventory': inv.id, 'playbook': 'hello_world.yml'}, admin_user
|
|
||||||
)
|
|
||||||
assert result.get('failed', False)
|
assert result.get('failed', False)
|
||||||
assert 'projects' in result['msg']
|
assert 'projects' in result['msg']
|
||||||
assert 'foo' 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,
|
'timeout': 4,
|
||||||
}
|
}
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_notification_template',
|
'notification_template',
|
||||||
dict(
|
dict(
|
||||||
name='foo-notification-template',
|
name='foo-notification-template',
|
||||||
organization=organization.name,
|
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
|
# Test no-op, this is impossible if the notification_configuration is given
|
||||||
# because we cannot determine if password fields changed
|
# because we cannot determine if password fields changed
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_notification_template',
|
'notification_template',
|
||||||
dict(
|
dict(
|
||||||
name='foo-notification-template',
|
name='foo-notification-template',
|
||||||
organization=organization.name,
|
organization=organization.name,
|
||||||
@@ -68,7 +68,7 @@ def test_create_modify_notification_template(run_module, admin_user, organizatio
|
|||||||
# Test a change in the configuration
|
# Test a change in the configuration
|
||||||
nt_config['timeout'] = 12
|
nt_config['timeout'] = 12
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_notification_template',
|
'notification_template',
|
||||||
dict(
|
dict(
|
||||||
name='foo-notification-template',
|
name='foo-notification-template',
|
||||||
organization=organization.name,
|
organization=organization.name,
|
||||||
@@ -87,7 +87,7 @@ def test_create_modify_notification_template(run_module, admin_user, organizatio
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_invalid_notification_configuration(run_module, admin_user, organization):
|
def test_invalid_notification_configuration(run_module, admin_user, organization):
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_notification_template',
|
'notification_template',
|
||||||
dict(
|
dict(
|
||||||
name='foo-notification-template',
|
name='foo-notification-template',
|
||||||
organization=organization.name,
|
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):
|
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'}}
|
nt_config = {'url': 'http://www.example.com/hook', 'headers': {'X-Custom-Header': 'value123'}}
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_notification_template',
|
'notification_template',
|
||||||
dict(
|
dict(
|
||||||
name='foo-notification-template',
|
name='foo-notification-template',
|
||||||
organization=organization.name,
|
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
|
assert result.pop('changed', None), result
|
||||||
|
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_notification_template',
|
'notification_template',
|
||||||
dict(
|
dict(
|
||||||
name='foo-notification-template',
|
name='foo-notification-template',
|
||||||
organization=organization.name,
|
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\') }}"}'}
|
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}
|
messages = {'started': custom_start_template, 'success': None, 'error': None, 'workflow_approval': None}
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_notification_template',
|
'notification_template',
|
||||||
dict(
|
dict(
|
||||||
name='foo-notification-template',
|
name='foo-notification-template',
|
||||||
organization=organization.name,
|
organization=organization.name,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ def test_create_organization(run_module, admin_user):
|
|||||||
'tower_config_file': None,
|
'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
|
assert result.get('changed'), result
|
||||||
|
|
||||||
org = Organization.objects.get(name='foo')
|
org = Organization.objects.get(name='foo')
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from awx.main.models import Project
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_create_project(run_module, admin_user, organization, silence_warning):
|
def test_create_project(run_module, admin_user, organization, silence_warning):
|
||||||
result = run_module(
|
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),
|
dict(name='foo', organization=organization.name, scm_type='git', scm_url='https://foo.invalid', wait=False, scm_update_cache_timeout=5),
|
||||||
admin_user,
|
admin_user,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ def test_grant_organization_permission(run_module, admin_user, organization, sta
|
|||||||
if state == 'absent':
|
if state == 'absent':
|
||||||
organization.admin_role.members.add(rando)
|
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)
|
assert not result.get('failed', False), result.get('msg', result)
|
||||||
|
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
@@ -31,7 +31,7 @@ def test_grant_workflow_permission(run_module, admin_user, organization, state):
|
|||||||
if state == 'absent':
|
if state == 'absent':
|
||||||
wfjt.execute_role.members.add(rando)
|
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)
|
assert not result.get('failed', False), result.get('msg', result)
|
||||||
|
|
||||||
if state == 'present':
|
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)
|
wfjt.execute_role.members.add(rando)
|
||||||
|
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_role',
|
'role',
|
||||||
{'user': rando.username, 'lookup_organization': wfjt.organization.name, 'workflows': [wfjt.name], 'role': 'execute', 'state': state},
|
{'user': rando.username, 'lookup_organization': wfjt.organization.name, 'workflows': [wfjt.name], 'role': 'execute', 'state': state},
|
||||||
admin_user,
|
admin_user,
|
||||||
)
|
)
|
||||||
@@ -69,7 +69,7 @@ def test_grant_workflow_approval_permission(run_module, admin_user, organization
|
|||||||
if state == 'absent':
|
if state == 'absent':
|
||||||
wfjt.execute_role.members.add(rando)
|
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)
|
assert not result.get('failed', False), result.get('msg', result)
|
||||||
|
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
@@ -81,7 +81,7 @@ def test_grant_workflow_approval_permission(run_module, admin_user, organization
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_invalid_role(run_module, admin_user, project):
|
def test_invalid_role(run_module, admin_user, project):
|
||||||
rando = User.objects.create(username='rando')
|
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)
|
assert result.get('failed', False)
|
||||||
msg = result.get('msg')
|
msg = result.get('msg')
|
||||||
assert 'has no role adhoc_role' in msg
|
assert 'has no role adhoc_role' in msg
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ from awx.api.serializers import SchedulePreviewSerializer
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_create_schedule(run_module, job_template, admin_user):
|
def test_create_schedule(run_module, job_template, admin_user):
|
||||||
my_rrule = 'DTSTART;TZID=Zulu:20200416T034507 RRULE:FREQ=MONTHLY;INTERVAL=1'
|
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)
|
assert not result.get('failed', False), result.get('msg', result)
|
||||||
|
|
||||||
schedule = Schedule.objects.filter(name='foo_schedule').first()
|
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):
|
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)
|
generated_rule = LookupModule.get_rrule(freq, kwargs)
|
||||||
assert generated_rule == expect
|
assert generated_rule == expect
|
||||||
rrule_checker = SchedulePreviewSerializer()
|
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'))
|
@pytest.mark.parametrize("freq", ('none', 'minute', 'hour', 'day', 'week', 'month'))
|
||||||
def test_empty_schedule_rrule(collection_import, freq):
|
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':
|
if freq == 'day':
|
||||||
pfreq = 'DAILY'
|
pfreq = 'DAILY'
|
||||||
elif freq == 'none':
|
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):
|
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:
|
with pytest.raises(AnsibleError) as e:
|
||||||
assert LookupModule.get_rrule(freq, kwargs)
|
assert LookupModule.get_rrule(freq, kwargs)
|
||||||
assert msg in str(e.value)
|
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
|
jt.admin_role.members.add(admin_user) # work around send/receive bug
|
||||||
|
|
||||||
# receive everything
|
# 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
|
assert 'assets' in result, result
|
||||||
assets = result['assets']
|
assets = result['assets']
|
||||||
@@ -47,7 +47,7 @@ def test_receive_send_jt(run_module, admin_user, mocker, silence_deprecation):
|
|||||||
# recreate everything
|
# recreate everything
|
||||||
with mocker.patch('sys.stdin.isatty', return_value=True):
|
with mocker.patch('sys.stdin.isatty', return_value=True):
|
||||||
with mocker.patch('tower_cli.models.base.MonitorableResource.wait'):
|
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
|
assert not result.get('failed'), result
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from awx.conf.models import Setting
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_setting_flat_value(run_module, admin_user):
|
def test_setting_flat_value(run_module, admin_user):
|
||||||
the_value = 'CN=service_account,OU=ServiceAccounts,DC=domain,DC=company,DC=org'
|
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 not result.get('failed', False), result.get('msg', result)
|
||||||
assert result.get('changed'), result
|
assert result.get('changed'), result
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ def test_setting_flat_value(run_module, admin_user):
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_setting_dict_value(run_module, admin_user):
|
def test_setting_dict_value(run_module, admin_user):
|
||||||
the_value = {'email': 'mail', 'first_name': 'givenName', 'last_name': 'surname'}
|
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 not result.get('failed', False), result.get('msg', result)
|
||||||
assert result.get('changed'), result
|
assert result.get('changed'), result
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ def test_setting_dict_value(run_module, admin_user):
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_setting_nested_type(run_module, admin_user):
|
def test_setting_nested_type(run_module, admin_user):
|
||||||
the_value = {'email': 'mail', 'first_name': 'givenName', 'last_name': 'surname'}
|
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 not result.get('failed', False), result.get('msg', result)
|
||||||
assert result.get('changed'), result
|
assert result.get('changed'), result
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ def test_setting_nested_type(run_module, admin_user):
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_setting_bool_value(run_module, admin_user):
|
def test_setting_bool_value(run_module, admin_user):
|
||||||
for the_value in (True, False):
|
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 not result.get('failed', False), result.get('msg', result)
|
||||||
assert result.get('changed'), 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):
|
def test_create_team(run_module, admin_user):
|
||||||
org = Organization.objects.create(name='foo')
|
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()
|
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')
|
team = Team.objects.create(name='foo_team', organization=org, description='flat foo')
|
||||||
assert team.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()
|
team.refresh_from_db()
|
||||||
result.pop('invocation')
|
result.pop('invocation')
|
||||||
assert result == {
|
assert result == {
|
||||||
@@ -42,6 +42,6 @@ def test_modify_team(run_module, admin_user):
|
|||||||
assert team.description == 'fooin around'
|
assert team.description == 'fooin around'
|
||||||
|
|
||||||
# 2nd modification, should cause no change
|
# 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')
|
result.pop('invocation')
|
||||||
assert result == {"id": team.id, "changed": False}
|
assert result == {"id": team.id, "changed": False}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ def test_create_token(run_module, admin_user):
|
|||||||
'tower_config_file': None,
|
'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
|
assert result.get('changed'), result
|
||||||
|
|
||||||
tokens = OAuth2AccessToken.objects.filter(description='barfoo')
|
tokens = OAuth2AccessToken.objects.filter(description='barfoo')
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ def mock_auth_stuff():
|
|||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_create_user(run_module, admin_user, mock_auth_stuff):
|
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 not result.get('failed', False), result.get('msg', result)
|
||||||
assert result.get('changed'), 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
|
@pytest.mark.django_db
|
||||||
def test_password_no_op_warning(run_module, admin_user, mock_auth_stuff, silence_warning):
|
def test_password_no_op_warning(run_module, admin_user, mock_auth_stuff, silence_warning):
|
||||||
for i in range(2):
|
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 not result.get('failed', False), result.get('msg', result)
|
||||||
|
|
||||||
assert result.get('changed') # not actually desired, but assert for sanity
|
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
|
@pytest.mark.django_db
|
||||||
def test_update_password_on_create(run_module, admin_user, mock_auth_stuff):
|
def test_update_password_on_create(run_module, admin_user, mock_auth_stuff):
|
||||||
for i in range(2):
|
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('failed', False), result.get('msg', result)
|
||||||
|
|
||||||
assert not result.get('changed')
|
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
|
@pytest.mark.django_db
|
||||||
def test_update_user(run_module, admin_user, mock_auth_stuff):
|
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 not result.get('failed', False), result.get('msg', result)
|
||||||
assert result.get('changed'), 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')
|
assert update_result.get('changed')
|
||||||
user = User.objects.get(id=result['id'])
|
user = User.objects.get(id=result['id'])
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from awx.main.models import WorkflowJobTemplate, NotificationTemplate
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_create_workflow_job_template(run_module, admin_user, organization, survey_spec):
|
def test_create_workflow_job_template(run_module, admin_user, organization, survey_spec):
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_workflow_job_template',
|
'workflow_job_template',
|
||||||
{
|
{
|
||||||
'name': 'foo-workflow',
|
'name': 'foo-workflow',
|
||||||
'organization': organization.name,
|
'organization': organization.name,
|
||||||
@@ -35,7 +35,7 @@ def test_create_workflow_job_template(run_module, admin_user, organization, surv
|
|||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_create_modify_no_survey(run_module, admin_user, organization, survey_spec):
|
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 not result.get('failed', False), result.get('msg', result)
|
||||||
assert result.get('changed', False), 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)
|
result.pop('invocation', None)
|
||||||
assert result == {"name": "foo-workflow", "id": wfjt.id, "changed": True}
|
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('failed', False), result.get('msg', result)
|
||||||
assert not result.get('changed', True), 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
|
@pytest.mark.django_db
|
||||||
def test_survey_spec_only_changed(run_module, admin_user, organization, survey_spec):
|
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)
|
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('failed', False), result.get('msg', result)
|
||||||
assert not result.get('changed', True), result
|
assert not result.get('changed', True), result
|
||||||
wfjt.refresh_from_db()
|
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'
|
survey_spec['description'] = 'changed description'
|
||||||
|
|
||||||
result = run_module(
|
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 not result.get('failed', False), result.get('msg', result)
|
||||||
assert result.get('changed', True), 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
|
@pytest.mark.django_db
|
||||||
def test_survey_spec_only_changed(run_module, admin_user, organization, survey_spec):
|
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)
|
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('failed', False), result.get('msg', result)
|
||||||
assert not result.get('changed', True), result
|
assert not result.get('changed', True), result
|
||||||
wfjt.refresh_from_db()
|
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']
|
del survey_spec['description']
|
||||||
|
|
||||||
result = run_module(
|
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('failed', True)
|
||||||
assert result.get('msg') == "Failed to update survey: Field 'description' is missing from survey spec."
|
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
|
# test preservation of error NTs when success NTs are added
|
||||||
result = run_module(
|
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 not result.get('failed', False), result.get('msg', result)
|
||||||
assert result.get('changed', True), 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]
|
assert list(wfjt.notification_templates_error.values_list('id', flat=True)) == [nt1.id]
|
||||||
|
|
||||||
# test removal to empty list
|
# test removal to empty list
|
||||||
result = run_module(
|
result = run_module('workflow_job_template', {'name': 'foo-workflow', 'organization': organization.name, 'notification_templates_success': []}, admin_user)
|
||||||
'tower_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 not result.get('failed', False), result.get('msg', result)
|
||||||
assert result.get('changed', True), 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
|
@pytest.mark.django_db
|
||||||
def test_delete_with_spec(run_module, admin_user, organization, survey_spec):
|
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)
|
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 not result.get('failed', False), result.get('msg', result)
|
||||||
assert result.get('changed', True), 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):
|
def test_create_workflow_job_template_node(run_module, admin_user, wfjt, job_template):
|
||||||
this_identifier = '42🐉'
|
this_identifier = '42🐉'
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_workflow_job_template_node',
|
'workflow_job_template_node',
|
||||||
{
|
{
|
||||||
'identifier': this_identifier,
|
'identifier': this_identifier,
|
||||||
'workflow_job_template': 'foo-workflow',
|
'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 is a part of the API contract for creating approval nodes"""
|
||||||
this_identifier = '42🐉'
|
this_identifier = '42🐉'
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_workflow_job_template_node',
|
'workflow_job_template_node',
|
||||||
{
|
{
|
||||||
'identifier': this_identifier,
|
'identifier': this_identifier,
|
||||||
'workflow_job_template': wfjt.name,
|
'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
|
@pytest.mark.django_db
|
||||||
def test_make_use_of_prompts(run_module, admin_user, wfjt, job_template, machine_credential, vault_credential):
|
def test_make_use_of_prompts(run_module, admin_user, wfjt, job_template, machine_credential, vault_credential):
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_workflow_job_template_node',
|
'workflow_job_template_node',
|
||||||
{
|
{
|
||||||
'identifier': '42',
|
'identifier': '42',
|
||||||
'workflow_job_template': 'foo-workflow',
|
'workflow_job_template': 'foo-workflow',
|
||||||
@@ -113,7 +113,7 @@ def test_create_with_edges(run_module, admin_user, wfjt, job_template):
|
|||||||
]
|
]
|
||||||
|
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_workflow_job_template_node',
|
'workflow_job_template_node',
|
||||||
{
|
{
|
||||||
'identifier': '42',
|
'identifier': '42',
|
||||||
'workflow_job_template': 'foo-workflow',
|
'workflow_job_template': 'foo-workflow',
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from awx.main.models import WorkflowJobTemplate, JobTemplate, Project, Inventory
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_create_workflow_job_template(run_module, admin_user, organization, survey_spec, silence_deprecation):
|
def test_create_workflow_job_template(run_module, admin_user, organization, survey_spec, silence_deprecation):
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_workflow_template',
|
'workflow_template',
|
||||||
{
|
{
|
||||||
'name': 'foo-workflow',
|
'name': 'foo-workflow',
|
||||||
'organization': organization.name,
|
'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)
|
wfjt1 = WorkflowJobTemplate.objects.create(name='first', organization=organization)
|
||||||
|
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_workflow_template',
|
'workflow_template',
|
||||||
{'name': 'foo-workflow', 'organization': organization.name, 'schema': [{'workflow': wfjt1.name}], 'state': 'present'},
|
{'name': 'foo-workflow', 'organization': organization.name, 'schema': [{'workflow': wfjt1.name}], 'state': 'present'},
|
||||||
admin_user,
|
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')
|
inv_src = InventorySource.objects.create(inventory=inv, name='AWS servers', source='ec2')
|
||||||
|
|
||||||
result = run_module(
|
result = run_module(
|
||||||
'tower_workflow_template',
|
'workflow_template',
|
||||||
{
|
{
|
||||||
'name': 'foo-workflow',
|
'name': 'foo-workflow',
|
||||||
'organization': organization.name,
|
'organization': organization.name,
|
||||||
@@ -96,7 +96,7 @@ def test_schema_with_branches(run_module, admin_user, organization, silence_depr
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_with_missing_ujt(run_module, admin_user, organization, silence_deprecation):
|
def test_with_missing_ujt(run_module, admin_user, organization, silence_deprecation):
|
||||||
result = run_module(
|
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 result.get('failed', False), result
|
||||||
assert 'You should provide exactly one of the attributes job_template,' in result['msg']
|
assert 'You should provide exactly one of the attributes job_template,' in result['msg']
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Launch an Ad Hoc Command waiting for it to finish
|
- name: Launch an Ad Hoc Command waiting for it to finish
|
||||||
tower_ad_hoc_command:
|
ad_hoc_command:
|
||||||
inventory: "{{ inv_name }}"
|
inventory: "{{ inv_name }}"
|
||||||
credential: "{{ ssh_cred_name }}"
|
credential: "{{ ssh_cred_name }}"
|
||||||
module_name: "command"
|
module_name: "command"
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
- "result.status == 'successful'"
|
- "result.status == 'successful'"
|
||||||
|
|
||||||
- name: Launch an Ad Hoc Command without module argument
|
- name: Launch an Ad Hoc Command without module argument
|
||||||
tower_ad_hoc_command:
|
ad_hoc_command:
|
||||||
inventory: "Demo Inventory"
|
inventory: "Demo Inventory"
|
||||||
credential: "{{ ssh_cred_name }}"
|
credential: "{{ ssh_cred_name }}"
|
||||||
module_name: "ping"
|
module_name: "ping"
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
- "result.status == 'successful'"
|
- "result.status == 'successful'"
|
||||||
|
|
||||||
- name: Check module fails with correct msg
|
- name: Check module fails with correct msg
|
||||||
tower_ad_hoc_command:
|
ad_hoc_command:
|
||||||
inventory: "{{ inv_name }}"
|
inventory: "{{ inv_name }}"
|
||||||
credential: "{{ ssh_cred_name }}"
|
credential: "{{ ssh_cred_name }}"
|
||||||
module_name: "Does not exist"
|
module_name: "Does not exist"
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Launch an Ad Hoc Command
|
- name: Launch an Ad Hoc Command
|
||||||
tower_ad_hoc_command:
|
ad_hoc_command:
|
||||||
inventory: "{{ inv_name }}"
|
inventory: "{{ inv_name }}"
|
||||||
credential: "{{ ssh_cred_name }}"
|
credential: "{{ ssh_cred_name }}"
|
||||||
module_name: "command"
|
module_name: "command"
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
- "command is changed"
|
- "command is changed"
|
||||||
|
|
||||||
- name: Timeout waiting for the command to cancel
|
- name: Timeout waiting for the command to cancel
|
||||||
tower_ad_hoc_command_cancel:
|
ad_hoc_command_cancel:
|
||||||
command_id: "{{ command.id }}"
|
command_id: "{{ command.id }}"
|
||||||
timeout: -1
|
timeout: -1
|
||||||
register: results
|
register: results
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
- "results['msg'] == 'Monitoring of ad hoc command aborted due to timeout'"
|
- "results['msg'] == 'Monitoring of ad hoc command aborted due to timeout'"
|
||||||
|
|
||||||
- name: Cancel the command with hard error if it's not running
|
- 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 }}"
|
command_id: "{{ command.id }}"
|
||||||
fail_if_not_running: true
|
fail_if_not_running: true
|
||||||
register: results
|
register: results
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
- results is failed
|
- results is failed
|
||||||
|
|
||||||
- name: Cancel an already canceled command (assert failure)
|
- name: Cancel an already canceled command (assert failure)
|
||||||
tower_ad_hoc_command_cancel:
|
ad_hoc_command_cancel:
|
||||||
command_id: "{{ command.id }}"
|
command_id: "{{ command.id }}"
|
||||||
fail_if_not_running: true
|
fail_if_not_running: true
|
||||||
register: results
|
register: results
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
- results is failed
|
- results is failed
|
||||||
|
|
||||||
- name: Check module fails with correct msg
|
- name: Check module fails with correct msg
|
||||||
tower_ad_hoc_command_cancel:
|
ad_hoc_command_cancel:
|
||||||
command_id: 9999999999
|
command_id: 9999999999
|
||||||
register: result
|
register: result
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Check module fails with correct msg
|
- name: Check module fails with correct msg
|
||||||
tower_ad_hoc_command_wait:
|
ad_hoc_command_wait:
|
||||||
command_id: "99999999"
|
command_id: "99999999"
|
||||||
register: result
|
register: result
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
- "result.msg == 'Unable to wait on ad hoc command 99999999; that ID does not exist in Tower.'"
|
- "result.msg == 'Unable to wait on ad hoc command 99999999; that ID does not exist in Tower.'"
|
||||||
|
|
||||||
- name: Launch command module with sleep 10
|
- name: Launch command module with sleep 10
|
||||||
tower_ad_hoc_command:
|
ad_hoc_command:
|
||||||
inventory: "{{ inv_name }}"
|
inventory: "{{ inv_name }}"
|
||||||
credential: "{{ ssh_cred_name }}"
|
credential: "{{ ssh_cred_name }}"
|
||||||
module_name: "command"
|
module_name: "command"
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
- command is changed
|
- command is changed
|
||||||
|
|
||||||
- name: Wait for the Job to finish
|
- name: Wait for the Job to finish
|
||||||
tower_ad_hoc_command_wait:
|
ad_hoc_command_wait:
|
||||||
command_id: "{{ command.id }}"
|
command_id: "{{ command.id }}"
|
||||||
register: wait_results
|
register: wait_results
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
- "'id' in wait_results"
|
- "'id' in wait_results"
|
||||||
|
|
||||||
- name: Launch a long running command
|
- name: Launch a long running command
|
||||||
tower_ad_hoc_command:
|
ad_hoc_command:
|
||||||
inventory: "{{ inv_name }}"
|
inventory: "{{ inv_name }}"
|
||||||
credential: "{{ ssh_cred_name }}"
|
credential: "{{ ssh_cred_name }}"
|
||||||
module_name: "command"
|
module_name: "command"
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
- command is changed
|
- command is changed
|
||||||
|
|
||||||
- name: Timeout waiting for the command to complete
|
- name: Timeout waiting for the command to complete
|
||||||
tower_ad_hoc_command_wait:
|
ad_hoc_command_wait:
|
||||||
command_id: "{{ command.id }}"
|
command_id: "{{ command.id }}"
|
||||||
timeout: 1
|
timeout: 1
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
@@ -95,13 +95,13 @@
|
|||||||
- "'id' in wait_results"
|
- "'id' in wait_results"
|
||||||
|
|
||||||
- name: Async cancel the long-running command
|
- name: Async cancel the long-running command
|
||||||
tower_ad_hoc_command_cancel:
|
ad_hoc_command_cancel:
|
||||||
command_id: "{{ command.id }}"
|
command_id: "{{ command.id }}"
|
||||||
async: 3600
|
async: 3600
|
||||||
poll: 0
|
poll: 0
|
||||||
|
|
||||||
- name: Wait for the command to exit on cancel
|
- name: Wait for the command to exit on cancel
|
||||||
tower_ad_hoc_command_wait:
|
ad_hoc_command_wait:
|
||||||
command_id: "{{ command.id }}"
|
command_id: "{{ command.id }}"
|
||||||
register: wait_results
|
register: wait_results
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
- "target_cred_result is changed"
|
- "target_cred_result is changed"
|
||||||
|
|
||||||
- name: Add credential Input Source
|
- name: Add credential Input Source
|
||||||
tower_credential_input_source:
|
credential_input_source:
|
||||||
input_field_name: password
|
input_field_name: password
|
||||||
target_credential: "{{ target_cred_result.id }}"
|
target_credential: "{{ target_cred_result.id }}"
|
||||||
source_credential: "{{ src_cred_result.id }}"
|
source_credential: "{{ src_cred_result.id }}"
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Change credential Input Source
|
- name: Change credential Input Source
|
||||||
tower_credential_input_source:
|
credential_input_source:
|
||||||
input_field_name: password
|
input_field_name: password
|
||||||
target_credential: "{{ target_cred_name }}"
|
target_credential: "{{ target_cred_name }}"
|
||||||
source_credential: "{{ src_cred_name }}-2"
|
source_credential: "{{ src_cred_name }}-2"
|
||||||
@@ -78,7 +78,7 @@
|
|||||||
|
|
||||||
always:
|
always:
|
||||||
- name: Remove a Tower credential source
|
- name: Remove a Tower credential source
|
||||||
tower_credential_input_source:
|
credential_input_source:
|
||||||
input_field_name: password
|
input_field_name: password
|
||||||
target_credential: "{{ target_cred_name }}"
|
target_credential: "{{ target_cred_name }}"
|
||||||
state: absent
|
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') }}"
|
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
|
- name: Add Tower credential type
|
||||||
tower_credential_type:
|
credential_type:
|
||||||
description: Credential type for Test
|
description: Credential type for Test
|
||||||
name: "{{ cred_type_name }}"
|
name: "{{ cred_type_name }}"
|
||||||
kind: cloud
|
kind: cloud
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Remove a Tower credential type
|
- name: Remove a Tower credential type
|
||||||
tower_credential_type:
|
credential_type:
|
||||||
name: "{{ result.id }}"
|
name: "{{ result.id }}"
|
||||||
state: absent
|
state: absent
|
||||||
register: result
|
register: result
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
scm_type: git
|
scm_type: git
|
||||||
state: absent
|
state: absent
|
||||||
loop: >
|
loop: >
|
||||||
{{ query('awx.awx.tower_api', 'projects',
|
{{ query('awx.awx.controller_api', 'projects',
|
||||||
query_params={'organization__isnull': true, 'name': 'Demo Project'})
|
query_params={'organization__isnull': true, 'name': 'Demo Project'})
|
||||||
}}
|
}}
|
||||||
loop_control:
|
loop_control:
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Assure that demo job template exists
|
- name: Assure that demo job template exists
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "Demo Job Template"
|
name: "Demo Job Template"
|
||||||
project: "Demo Project"
|
project: "Demo Project"
|
||||||
inventory: "Demo Inventory"
|
inventory: "Demo Inventory"
|
||||||
|
|||||||
@@ -93,7 +93,7 @@
|
|||||||
|
|
||||||
- name: "Find number of hosts in {{ group_name1 }}"
|
- name: "Find number of hosts in {{ group_name1 }}"
|
||||||
set_fact:
|
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:
|
- assert:
|
||||||
that:
|
that:
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
- "cred_result is changed"
|
- "cred_result is changed"
|
||||||
|
|
||||||
- name: Create an Instance Group
|
- name: Create an Instance Group
|
||||||
tower_instance_group:
|
instance_group:
|
||||||
name: "{{ group_name1 }}"
|
name: "{{ group_name1 }}"
|
||||||
policy_instance_percentage: 34
|
policy_instance_percentage: 34
|
||||||
policy_instance_minimum: 12
|
policy_instance_minimum: 12
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Update an Instance Group
|
- name: Update an Instance Group
|
||||||
tower_instance_group:
|
instance_group:
|
||||||
name: "{{ result.id }}"
|
name: "{{ result.id }}"
|
||||||
policy_instance_percentage: 34
|
policy_instance_percentage: 34
|
||||||
policy_instance_minimum: 24
|
policy_instance_minimum: 24
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Create a container group
|
- name: Create a container group
|
||||||
tower_instance_group:
|
instance_group:
|
||||||
name: "{{ group_name2 }}"
|
name: "{{ group_name2 }}"
|
||||||
credential: "{{ cred_result.id }}"
|
credential: "{{ cred_result.id }}"
|
||||||
is_container_group: true
|
is_container_group: true
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
always:
|
always:
|
||||||
- name: Delete the instance groups
|
- name: Delete the instance groups
|
||||||
tower_instance_group:
|
instance_group:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: absent
|
state: absent
|
||||||
loop:
|
loop:
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
- block:
|
- block:
|
||||||
|
|
||||||
- name: Create an Instance Group
|
- name: Create an Instance Group
|
||||||
tower_instance_group:
|
instance_group:
|
||||||
name: "{{ group_name1 }}"
|
name: "{{ group_name1 }}"
|
||||||
state: present
|
state: present
|
||||||
register: result
|
register: result
|
||||||
@@ -174,7 +174,7 @@
|
|||||||
- "copy_{{ inv_name1 }}"
|
- "copy_{{ inv_name1 }}"
|
||||||
|
|
||||||
- name: Delete the instance groups
|
- name: Delete the instance groups
|
||||||
tower_instance_group:
|
instance_group:
|
||||||
name: "{{ group_name1 }}"
|
name: "{{ group_name1 }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
name: "{{ openstack_inv }}"
|
name: "{{ openstack_inv }}"
|
||||||
|
|
||||||
- name: Create a source inventory
|
- name: Create a source inventory
|
||||||
tower_inventory_source:
|
inventory_source:
|
||||||
name: "{{ openstack_inv_source }}"
|
name: "{{ openstack_inv_source }}"
|
||||||
description: Source for Test inventory
|
description: Source for Test inventory
|
||||||
inventory: "{{ openstack_inv }}"
|
inventory: "{{ openstack_inv }}"
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Delete the inventory source with an invalid cred and source_project specified
|
- name: Delete the inventory source with an invalid cred and source_project specified
|
||||||
tower_inventory_source:
|
inventory_source:
|
||||||
name: "{{ result.id }}"
|
name: "{{ result.id }}"
|
||||||
inventory: "{{ openstack_inv }}"
|
inventory: "{{ openstack_inv }}"
|
||||||
credential: "Does Not Exit"
|
credential: "Does Not Exit"
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
register: created_inventory
|
register: created_inventory
|
||||||
|
|
||||||
- name: Create an Inventory Source (specifically connected to the randomly generated org)
|
- name: Create an Inventory Source (specifically connected to the randomly generated org)
|
||||||
tower_inventory_source:
|
inventory_source:
|
||||||
name: "{{ inv_source1 }}"
|
name: "{{ inv_source1 }}"
|
||||||
source: scm
|
source: scm
|
||||||
source_project: "{{ project_name }}"
|
source_project: "{{ project_name }}"
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
inventory: "{{ inv_name }}"
|
inventory: "{{ inv_name }}"
|
||||||
|
|
||||||
- name: Create Another Inventory Source
|
- name: Create Another Inventory Source
|
||||||
tower_inventory_source:
|
inventory_source:
|
||||||
name: "{{ inv_source2 }}"
|
name: "{{ inv_source2 }}"
|
||||||
source: scm
|
source: scm
|
||||||
source_project: "{{ project_name }}"
|
source_project: "{{ project_name }}"
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
inventory: "{{ inv_name }}"
|
inventory: "{{ inv_name }}"
|
||||||
|
|
||||||
- name: Create Yet Another Inventory Source (to make lookup plugin find multiple inv sources)
|
- name: Create Yet Another Inventory Source (to make lookup plugin find multiple inv sources)
|
||||||
tower_inventory_source:
|
inventory_source:
|
||||||
name: "{{ inv_source3 }}"
|
name: "{{ inv_source3 }}"
|
||||||
source: scm
|
source: scm
|
||||||
source_project: "{{ project_name }}"
|
source_project: "{{ project_name }}"
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
inventory: "{{ inv_name }}"
|
inventory: "{{ inv_name }}"
|
||||||
|
|
||||||
- name: Test Inventory Source Update
|
- name: Test Inventory Source Update
|
||||||
tower_inventory_source_update:
|
inventory_source_update:
|
||||||
name: "{{ inv_source2 }}"
|
name: "{{ inv_source2 }}"
|
||||||
inventory: "{{ inv_name }}"
|
inventory: "{{ inv_name }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
@@ -83,12 +83,12 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Test Inventory Source Update for All Sources
|
- name: Test Inventory Source Update for All Sources
|
||||||
tower_inventory_source_update:
|
inventory_source_update:
|
||||||
name: "{{ item.name }}"
|
name: "{{ item.name }}"
|
||||||
inventory: "{{ inv_name }}"
|
inventory: "{{ inv_name }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
wait: true
|
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:
|
loop_control:
|
||||||
label: "{{ item.name }}"
|
label: "{{ item.name }}"
|
||||||
register: result
|
register: result
|
||||||
@@ -98,12 +98,12 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Test Inventory Source Update for All Sources (using inventory_source as alias for name)
|
- 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_source: "{{ item.name }}"
|
||||||
inventory: "{{ inv_name }}"
|
inventory: "{{ inv_name }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
wait: true
|
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:
|
loop_control:
|
||||||
label: "{{ item.name }}"
|
label: "{{ item.name }}"
|
||||||
register: result
|
register: result
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: Launch a Job Template
|
- name: Launch a Job Template
|
||||||
tower_job_launch:
|
job_launch:
|
||||||
job_template: "Demo Job Template"
|
job_template: "Demo Job Template"
|
||||||
register: job
|
register: job
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
- "job is changed"
|
- "job is changed"
|
||||||
|
|
||||||
- name: Cancel the job
|
- name: Cancel the job
|
||||||
tower_job_cancel:
|
job_cancel:
|
||||||
job_id: "{{ job.id }}"
|
job_id: "{{ job.id }}"
|
||||||
register: results
|
register: results
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
- results is changed
|
- results is changed
|
||||||
|
|
||||||
- name: Cancel an already canceled job (assert failure)
|
- name: Cancel an already canceled job (assert failure)
|
||||||
tower_job_cancel:
|
job_cancel:
|
||||||
job_id: "{{ job.id }}"
|
job_id: "{{ job.id }}"
|
||||||
fail_if_not_running: true
|
fail_if_not_running: true
|
||||||
register: results
|
register: results
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
- results is failed
|
- results is failed
|
||||||
|
|
||||||
- name: Check module fails with correct msg
|
- name: Check module fails with correct msg
|
||||||
tower_job_cancel:
|
job_cancel:
|
||||||
job_id: 9999999999
|
job_id: 9999999999
|
||||||
register: result
|
register: result
|
||||||
ignore_errors: true
|
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') }}"
|
proj_name: "AWX-Collection-tests-tower_job_launch-project-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
|
||||||
|
|
||||||
- name: Launch a Job Template
|
- name: Launch a Job Template
|
||||||
tower_job_launch:
|
job_launch:
|
||||||
job_template: "Demo Job Template"
|
job_template: "Demo Job Template"
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
- "result.status == 'pending'"
|
- "result.status == 'pending'"
|
||||||
|
|
||||||
- name: Wait for a job template to complete
|
- name: Wait for a job template to complete
|
||||||
tower_job_wait:
|
job_wait:
|
||||||
job_id: "{{ result.id }}"
|
job_id: "{{ result.id }}"
|
||||||
max_interval: 10
|
max_interval: 10
|
||||||
timeout: 120
|
timeout: 120
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
- "result.status == 'successful'"
|
- "result.status == 'successful'"
|
||||||
|
|
||||||
- name: Check module fails with correct msg
|
- name: Check module fails with correct msg
|
||||||
tower_job_launch:
|
job_launch:
|
||||||
job_template: "Non_Existing_Job_Template"
|
job_template: "Non_Existing_Job_Template"
|
||||||
inventory: "Demo Inventory"
|
inventory: "Demo Inventory"
|
||||||
register: result
|
register: result
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
- "'Non_Existing_Job_Template' in result.msg"
|
- "'Non_Existing_Job_Template' in result.msg"
|
||||||
|
|
||||||
- name: Create a Job Template for testing prompt on launch
|
- name: Create a Job Template for testing prompt on launch
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt_name1 }}"
|
name: "{{ jt_name1 }}"
|
||||||
project: Demo Project
|
project: Demo Project
|
||||||
playbook: hello_world.yml
|
playbook: hello_world.yml
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Launch job template with inventory and credential for prompt on launch
|
- name: Launch job template with inventory and credential for prompt on launch
|
||||||
tower_job_launch:
|
job_launch:
|
||||||
job_template: "{{ jt_name1 }}"
|
job_template: "{{ jt_name1 }}"
|
||||||
inventory: "Demo Inventory"
|
inventory: "Demo Inventory"
|
||||||
credential: "Demo Credential"
|
credential: "Demo Credential"
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
scm_url: https://github.com/ansible/test-playbooks
|
scm_url: https://github.com/ansible/test-playbooks
|
||||||
|
|
||||||
- name: Create the job template with survey
|
- name: Create the job template with survey
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt_name2 }}"
|
name: "{{ jt_name2 }}"
|
||||||
project: "{{ proj_name }}"
|
project: "{{ proj_name }}"
|
||||||
playbook: debug.yml
|
playbook: debug.yml
|
||||||
@@ -114,7 +114,7 @@
|
|||||||
new_question: true
|
new_question: true
|
||||||
|
|
||||||
- name: Kick off a job template with survey
|
- name: Kick off a job template with survey
|
||||||
tower_job_launch:
|
job_launch:
|
||||||
job_template: "{{ jt_name2 }}"
|
job_template: "{{ jt_name2 }}"
|
||||||
extra_vars:
|
extra_vars:
|
||||||
basic_name: My First Variable
|
basic_name: My First Variable
|
||||||
@@ -127,14 +127,14 @@
|
|||||||
- result is not failed
|
- result is not failed
|
||||||
|
|
||||||
- name: Prompt the job templates extra_vars on launch
|
- name: Prompt the job templates extra_vars on launch
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt_name2 }}"
|
name: "{{ jt_name2 }}"
|
||||||
state: present
|
state: present
|
||||||
ask_variables_on_launch: true
|
ask_variables_on_launch: true
|
||||||
|
|
||||||
|
|
||||||
- name: Kick off a job template with extra_vars
|
- name: Kick off a job template with extra_vars
|
||||||
tower_job_launch:
|
job_launch:
|
||||||
job_template: "{{ jt_name2 }}"
|
job_template: "{{ jt_name2 }}"
|
||||||
extra_vars:
|
extra_vars:
|
||||||
basic_name: My First Variable
|
basic_name: My First Variable
|
||||||
@@ -148,7 +148,7 @@
|
|||||||
- result is not failed
|
- result is not failed
|
||||||
|
|
||||||
- name: Create a Job Template for testing extra_vars
|
- name: Create a Job Template for testing extra_vars
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt_name2 }}"
|
name: "{{ jt_name2 }}"
|
||||||
project: "{{ proj_name }}"
|
project: "{{ proj_name }}"
|
||||||
playbook: debug.yml
|
playbook: debug.yml
|
||||||
@@ -161,7 +161,7 @@
|
|||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Launch job template with inventory and credential for prompt on launch
|
- name: Launch job template with inventory and credential for prompt on launch
|
||||||
tower_job_launch:
|
job_launch:
|
||||||
job_template: "{{ jt_name2 }}"
|
job_template: "{{ jt_name2 }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
register: result
|
register: result
|
||||||
@@ -171,7 +171,7 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Wait for a job template to complete
|
- name: Wait for a job template to complete
|
||||||
tower_job_wait:
|
job_wait:
|
||||||
job_id: "{{ result.id }}"
|
job_id: "{{ result.id }}"
|
||||||
max_interval: 10
|
max_interval: 10
|
||||||
timeout: 120
|
timeout: 120
|
||||||
@@ -183,7 +183,7 @@
|
|||||||
- "result.status == 'successful'"
|
- "result.status == 'successful'"
|
||||||
|
|
||||||
- name: Get the job
|
- name: Get the job
|
||||||
tower_job_list:
|
job_list:
|
||||||
query: {"id": "{{result.id}}"}
|
query: {"id": "{{result.id}}"}
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
@@ -192,7 +192,7 @@
|
|||||||
- '{"foo": "bar"} | to_json in result.results[0].extra_vars'
|
- '{"foo": "bar"} | to_json in result.results[0].extra_vars'
|
||||||
|
|
||||||
- name: Delete the first jt
|
- name: Delete the first jt
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt_name1 }}"
|
name: "{{ jt_name1 }}"
|
||||||
project: Demo Project
|
project: Demo Project
|
||||||
playbook: hello_world.yml
|
playbook: hello_world.yml
|
||||||
@@ -204,7 +204,7 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Delete the second jt
|
- name: Delete the second jt
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt_name2 }}"
|
name: "{{ jt_name2 }}"
|
||||||
project: "{{ proj_name }}"
|
project: "{{ proj_name }}"
|
||||||
playbook: debug.yml
|
playbook: debug.yml
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: Launch a Job Template
|
- name: Launch a Job Template
|
||||||
tower_job_launch:
|
job_launch:
|
||||||
job_template: "Demo Job Template"
|
job_template: "Demo Job Template"
|
||||||
register: job
|
register: job
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
- "job.status == 'pending'"
|
- "job.status == 'pending'"
|
||||||
|
|
||||||
- name: List jobs w/ a matching primary key
|
- name: List jobs w/ a matching primary key
|
||||||
tower_job_list:
|
job_list:
|
||||||
query: {"id": "{{ job.id }}"}
|
query: {"id": "{{ job.id }}"}
|
||||||
register: matching_jobs
|
register: matching_jobs
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
- "{{ matching_jobs.count }} == 1"
|
- "{{ matching_jobs.count }} == 1"
|
||||||
|
|
||||||
- name: List failed jobs (which don't exist)
|
- name: List failed jobs (which don't exist)
|
||||||
tower_job_list:
|
job_list:
|
||||||
status: failed
|
status: failed
|
||||||
query: {"id": "{{ job.id }}"}
|
query: {"id": "{{ job.id }}"}
|
||||||
register: successful_jobs
|
register: successful_jobs
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
- "{{ successful_jobs.count }} == 0"
|
- "{{ successful_jobs.count }} == 0"
|
||||||
|
|
||||||
- name: Get ALL result pages!
|
- name: Get ALL result pages!
|
||||||
tower_job_list:
|
job_list:
|
||||||
all_pages: true
|
all_pages: true
|
||||||
register: all_page_query
|
register: all_page_query
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@
|
|||||||
- "{{ org_name }}"
|
- "{{ org_name }}"
|
||||||
|
|
||||||
- name: Create an Instance Group
|
- name: Create an Instance Group
|
||||||
tower_instance_group:
|
instance_group:
|
||||||
name: "{{ group_name1 }}"
|
name: "{{ group_name1 }}"
|
||||||
state: present
|
state: present
|
||||||
register: result
|
register: result
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Add email notification
|
- name: Add email notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: "{{ email_not }}"
|
name: "{{ email_not }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
notification_type: email
|
notification_type: email
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Add webhook notification
|
- name: Add webhook notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: "{{ webhook_not }}"
|
name: "{{ webhook_not }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
notification_type: webhook
|
notification_type: webhook
|
||||||
@@ -98,7 +98,7 @@
|
|||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Create Job Template 1
|
- name: Create Job Template 1
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt1 }}"
|
name: "{{ jt1 }}"
|
||||||
project: "{{ proj1 }}"
|
project: "{{ proj1 }}"
|
||||||
inventory: Demo Inventory
|
inventory: Demo Inventory
|
||||||
@@ -117,7 +117,7 @@
|
|||||||
- "jt1_result is changed"
|
- "jt1_result is changed"
|
||||||
|
|
||||||
- name: Add a credential to this JT
|
- name: Add a credential to this JT
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt1 }}"
|
name: "{{ jt1 }}"
|
||||||
project: "{{ proj_result.id }}"
|
project: "{{ proj_result.id }}"
|
||||||
playbook: hello_world.yml
|
playbook: hello_world.yml
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Try to add the same credential to this JT
|
- name: Try to add the same credential to this JT
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt1_result.id }}"
|
name: "{{ jt1_result.id }}"
|
||||||
project: "{{ proj1 }}"
|
project: "{{ proj1 }}"
|
||||||
playbook: hello_world.yml
|
playbook: hello_world.yml
|
||||||
@@ -143,7 +143,7 @@
|
|||||||
- "result is not changed"
|
- "result is not changed"
|
||||||
|
|
||||||
- name: Add another credential to this JT
|
- name: Add another credential to this JT
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt1 }}"
|
name: "{{ jt1 }}"
|
||||||
project: "{{ proj1 }}"
|
project: "{{ proj1 }}"
|
||||||
playbook: hello_world.yml
|
playbook: hello_world.yml
|
||||||
@@ -157,7 +157,7 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Remove a credential for this JT
|
- name: Remove a credential for this JT
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt1 }}"
|
name: "{{ jt1 }}"
|
||||||
project: "{{ proj1 }}"
|
project: "{{ proj1 }}"
|
||||||
playbook: hello_world.yml
|
playbook: hello_world.yml
|
||||||
@@ -170,7 +170,7 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Remove all credentials from this JT
|
- name: Remove all credentials from this JT
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt1 }}"
|
name: "{{ jt1 }}"
|
||||||
project: "{{ proj1 }}"
|
project: "{{ proj1 }}"
|
||||||
playbook: hello_world.yml
|
playbook: hello_world.yml
|
||||||
@@ -182,13 +182,13 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Copy Job Template
|
- name: Copy Job Template
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "copy_{{ jt1 }}"
|
name: "copy_{{ jt1 }}"
|
||||||
copy_from: "{{ jt1 }}"
|
copy_from: "{{ jt1 }}"
|
||||||
state: "present"
|
state: "present"
|
||||||
|
|
||||||
- name: Delete copied Job Template
|
- name: Delete copied Job Template
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "copy_{{ jt1 }}"
|
name: "copy_{{ jt1 }}"
|
||||||
job_type: run
|
job_type: run
|
||||||
state: absent
|
state: absent
|
||||||
@@ -196,7 +196,7 @@
|
|||||||
|
|
||||||
# This doesnt work if you include the credentials parameter
|
# This doesnt work if you include the credentials parameter
|
||||||
- name: Delete Job Template 1
|
- name: Delete Job Template 1
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt1 }}"
|
name: "{{ jt1 }}"
|
||||||
playbook: hello_world.yml
|
playbook: hello_world.yml
|
||||||
job_type: run
|
job_type: run
|
||||||
@@ -211,7 +211,7 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Create Job Template 2
|
- name: Create Job Template 2
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt2 }}"
|
name: "{{ jt2 }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
project: "{{ proj1 }}"
|
project: "{{ proj1 }}"
|
||||||
@@ -229,7 +229,7 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Add survey to Job Template 2
|
- name: Add survey to Job Template 2
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt2 }}"
|
name: "{{ jt2 }}"
|
||||||
survey_enabled: true
|
survey_enabled: true
|
||||||
survey_spec:
|
survey_spec:
|
||||||
@@ -251,7 +251,7 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Re Add survey to Job Template 2
|
- name: Re Add survey to Job Template 2
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt2 }}"
|
name: "{{ jt2 }}"
|
||||||
survey_enabled: true
|
survey_enabled: true
|
||||||
survey_spec:
|
survey_spec:
|
||||||
@@ -273,7 +273,7 @@
|
|||||||
- "result is not changed"
|
- "result is not changed"
|
||||||
|
|
||||||
- name: Add question to survey to Job Template 2
|
- name: Add question to survey to Job Template 2
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt2 }}"
|
name: "{{ jt2 }}"
|
||||||
survey_enabled: true
|
survey_enabled: true
|
||||||
survey_spec:
|
survey_spec:
|
||||||
@@ -300,7 +300,7 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Remove survey from Job Template 2
|
- name: Remove survey from Job Template 2
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt2 }}"
|
name: "{{ jt2 }}"
|
||||||
survey_enabled: false
|
survey_enabled: false
|
||||||
survey_spec: {}
|
survey_spec: {}
|
||||||
@@ -311,7 +311,7 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Add started notifications to Job Template 2
|
- name: Add started notifications to Job Template 2
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt2 }}"
|
name: "{{ jt2 }}"
|
||||||
notification_templates_started:
|
notification_templates_started:
|
||||||
- "{{ email_not }}"
|
- "{{ email_not }}"
|
||||||
@@ -323,7 +323,7 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Re Add started notifications to Job Template 2
|
- name: Re Add started notifications to Job Template 2
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt2 }}"
|
name: "{{ jt2 }}"
|
||||||
notification_templates_started:
|
notification_templates_started:
|
||||||
- "{{ email_not }}"
|
- "{{ email_not }}"
|
||||||
@@ -335,7 +335,7 @@
|
|||||||
- "result is not changed"
|
- "result is not changed"
|
||||||
|
|
||||||
- name: Add success notifications to Job Template 2
|
- name: Add success notifications to Job Template 2
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt2 }}"
|
name: "{{ jt2 }}"
|
||||||
notification_templates_success:
|
notification_templates_success:
|
||||||
- "{{ email_not }}"
|
- "{{ email_not }}"
|
||||||
@@ -347,7 +347,7 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Remove "on start" webhook notification from Job Template 2
|
- name: Remove "on start" webhook notification from Job Template 2
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt2 }}"
|
name: "{{ jt2 }}"
|
||||||
notification_templates_started:
|
notification_templates_started:
|
||||||
- "{{ email_not }}"
|
- "{{ email_not }}"
|
||||||
@@ -359,7 +359,7 @@
|
|||||||
|
|
||||||
|
|
||||||
- name: Delete Job Template 2
|
- name: Delete Job Template 2
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt2 }}"
|
name: "{{ jt2 }}"
|
||||||
project: "{{ proj1 }}"
|
project: "{{ proj1 }}"
|
||||||
inventory: Demo Inventory
|
inventory: Demo Inventory
|
||||||
@@ -406,18 +406,18 @@
|
|||||||
# You can't delete a label directly so no cleanup needed
|
# You can't delete a label directly so no cleanup needed
|
||||||
|
|
||||||
- name: Delete email notification
|
- name: Delete email notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: "{{ email_not }}"
|
name: "{{ email_not }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Delete the instance groups
|
- name: Delete the instance groups
|
||||||
tower_instance_group:
|
instance_group:
|
||||||
name: "{{ group_name1 }}"
|
name: "{{ group_name1 }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Delete webhook notification
|
- name: Delete webhook notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: "{{ webhook_not }}"
|
name: "{{ webhook_not }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
state: absent
|
state: absent
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
organization: Default
|
organization: Default
|
||||||
|
|
||||||
- name: Create a job template
|
- name: Create a job template
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt_name }}"
|
name: "{{ jt_name }}"
|
||||||
playbook: "sleep.yml"
|
playbook: "sleep.yml"
|
||||||
job_type: run
|
job_type: run
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
sleep_interval: 300
|
sleep_interval: 300
|
||||||
|
|
||||||
- name: Check deprecation warnings
|
- name: Check deprecation warnings
|
||||||
tower_job_wait:
|
job_wait:
|
||||||
min_interval: 10
|
min_interval: 10
|
||||||
max_interval: 20
|
max_interval: 20
|
||||||
job_id: "99999999"
|
job_id: "99999999"
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
- "'Min and max interval have been deprecated, please use interval instead; interval will be set to 15'"
|
- "'Min and max interval have been deprecated, please use interval instead; interval will be set to 15'"
|
||||||
|
|
||||||
- name: Validate that interval superceeds min/max
|
- name: Validate that interval superceeds min/max
|
||||||
tower_job_wait:
|
job_wait:
|
||||||
min_interval: 10
|
min_interval: 10
|
||||||
max_interval: 20
|
max_interval: 20
|
||||||
interval: 12
|
interval: 12
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
'min and max interval have been depricated, please use interval instead, interval will be set to 12'"
|
'min and max interval have been depricated, please use interval instead, interval will be set to 12'"
|
||||||
|
|
||||||
- name: Check module fails with correct msg
|
- name: Check module fails with correct msg
|
||||||
tower_job_wait:
|
job_wait:
|
||||||
job_id: "99999999"
|
job_id: "99999999"
|
||||||
register: result
|
register: result
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
'Unable to wait on job 99999999; that ID does not exist in Tower.'"
|
'Unable to wait on job 99999999; that ID does not exist in Tower.'"
|
||||||
|
|
||||||
- name: Launch Demo Job Template (take happy path)
|
- name: Launch Demo Job Template (take happy path)
|
||||||
tower_job_launch:
|
job_launch:
|
||||||
job_template: "Demo Job Template"
|
job_template: "Demo Job Template"
|
||||||
register: job
|
register: job
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
- job is changed
|
- job is changed
|
||||||
|
|
||||||
- name: Wait for the Job to finish
|
- name: Wait for the Job to finish
|
||||||
tower_job_wait:
|
job_wait:
|
||||||
job_id: "{{ job.id }}"
|
job_id: "{{ job.id }}"
|
||||||
register: wait_results
|
register: wait_results
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
- "'id' in wait_results"
|
- "'id' in wait_results"
|
||||||
|
|
||||||
- name: Launch a long running job
|
- name: Launch a long running job
|
||||||
tower_job_launch:
|
job_launch:
|
||||||
job_template: "{{ jt_name }}"
|
job_template: "{{ jt_name }}"
|
||||||
register: job
|
register: job
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
- job is changed
|
- job is changed
|
||||||
|
|
||||||
- name: Timeout waiting for the job to complete
|
- name: Timeout waiting for the job to complete
|
||||||
tower_job_wait:
|
job_wait:
|
||||||
job_id: "{{ job.id }}"
|
job_id: "{{ job.id }}"
|
||||||
timeout: 5
|
timeout: 5
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
@@ -104,13 +104,13 @@
|
|||||||
- "'id' in wait_results"
|
- "'id' in wait_results"
|
||||||
|
|
||||||
- name: Async cancel the long running job
|
- name: Async cancel the long running job
|
||||||
tower_job_cancel:
|
job_cancel:
|
||||||
job_id: "{{ job.id }}"
|
job_id: "{{ job.id }}"
|
||||||
async: 3600
|
async: 3600
|
||||||
poll: 0
|
poll: 0
|
||||||
|
|
||||||
- name: Wait for the job to exit on cancel
|
- name: Wait for the job to exit on cancel
|
||||||
tower_job_wait:
|
job_wait:
|
||||||
job_id: "{{ job.id }}"
|
job_id: "{{ job.id }}"
|
||||||
register: wait_results
|
register: wait_results
|
||||||
ignore_errors: true
|
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.'"
|
- "wait_results.msg == 'Job with id {{ job.id }} failed' or 'Job with id={{ job.id }} failed, error: Job failed.'"
|
||||||
|
|
||||||
- name: Delete the job template
|
- name: Delete the job template
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt_name }}"
|
name: "{{ jt_name }}"
|
||||||
playbook: "sleep.yml"
|
playbook: "sleep.yml"
|
||||||
job_type: run
|
job_type: run
|
||||||
@@ -147,25 +147,25 @@
|
|||||||
wfjt_name2: "AWX-Collection-tests-tower_workflow_launch--wfjt1-{{ test_id1 }}"
|
wfjt_name2: "AWX-Collection-tests-tower_workflow_launch--wfjt1-{{ test_id1 }}"
|
||||||
|
|
||||||
- name: Create our workflow
|
- name: Create our workflow
|
||||||
tower_workflow_job_template:
|
workflow_job_template:
|
||||||
name: "{{ wfjt_name2 }}"
|
name: "{{ wfjt_name2 }}"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Add a node
|
- name: Add a node
|
||||||
tower_workflow_job_template_node:
|
workflow_job_template_node:
|
||||||
workflow_job_template: "{{ wfjt_name2 }}"
|
workflow_job_template: "{{ wfjt_name2 }}"
|
||||||
unified_job_template: "Demo Job Template"
|
unified_job_template: "Demo Job Template"
|
||||||
identifier: leaf
|
identifier: leaf
|
||||||
register: new_node
|
register: new_node
|
||||||
|
|
||||||
- name: Kick off a workflow
|
- name: Kick off a workflow
|
||||||
tower_workflow_launch:
|
workflow_launch:
|
||||||
workflow_template: "{{ wfjt_name2 }}"
|
workflow_template: "{{ wfjt_name2 }}"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: workflow
|
register: workflow
|
||||||
|
|
||||||
- name: Wait for the Workflow Job to finish
|
- name: Wait for the Workflow Job to finish
|
||||||
tower_job_wait:
|
job_wait:
|
||||||
job_id: "{{ workflow.job_info.id }}"
|
job_id: "{{ workflow.job_info.id }}"
|
||||||
job_type: "workflow_jobs"
|
job_type: "workflow_jobs"
|
||||||
register: wait_workflow_results
|
register: wait_workflow_results
|
||||||
@@ -178,6 +178,6 @@
|
|||||||
- "'id' in wait_workflow_results"
|
- "'id' in wait_workflow_results"
|
||||||
|
|
||||||
- name: Clean up test workflow
|
- name: Clean up test workflow
|
||||||
tower_workflow_job_template:
|
workflow_job_template:
|
||||||
name: "{{ wfjt_name2 }}"
|
name: "{{ wfjt_name2 }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
- name: Generate the name of our plugin
|
- name: Generate the name of our plugin
|
||||||
set_fact:
|
set_fact:
|
||||||
plugin_name: "{{ tower_meta.prefix }}.tower_api"
|
plugin_name: "{{ tower_meta.prefix }}.controller_api"
|
||||||
|
|
||||||
- name: Create all of our users
|
- name: Create all of our users
|
||||||
user:
|
user:
|
||||||
@@ -177,7 +177,7 @@
|
|||||||
# DOCS Example Tests
|
# DOCS Example Tests
|
||||||
- name: Load the UI settings
|
- name: Load the UI settings
|
||||||
set_fact:
|
set_fact:
|
||||||
tower_settings: "{{ lookup('awx.awx.tower_api', 'settings/ui') }}"
|
tower_settings: "{{ lookup('awx.awx.controller_api', 'settings/ui') }}"
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
@@ -185,7 +185,7 @@
|
|||||||
|
|
||||||
- name: Display the usernames of all admin users
|
- name: Display the usernames of all admin users
|
||||||
debug:
|
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
|
register: results
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
@@ -195,7 +195,7 @@
|
|||||||
- name: debug all organizations in a loop # use query to return a list
|
- name: debug all organizations in a loop # use query to return a list
|
||||||
debug:
|
debug:
|
||||||
msg: "Organization description={{ item['description'] }} id={{ item['id'] }}"
|
msg: "Organization description={{ item['description'] }} id={{ item['id'] }}"
|
||||||
loop: "{{ query('awx.awx.tower_api', 'organizations') }}"
|
loop: "{{ query('awx.awx.controller_api', 'organizations') }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item['name'] }}"
|
label: "{{ item['name'] }}"
|
||||||
|
|
||||||
@@ -206,7 +206,7 @@
|
|||||||
user: "{{ usernames[0] }}"
|
user: "{{ usernames[0] }}"
|
||||||
state: absent
|
state: absent
|
||||||
register: tower_role_revoke
|
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:
|
- assert:
|
||||||
that:
|
that:
|
||||||
@@ -218,7 +218,7 @@
|
|||||||
inventory: "Demo Inventory"
|
inventory: "Demo Inventory"
|
||||||
hosts: >-
|
hosts: >-
|
||||||
{{ query(
|
{{ query(
|
||||||
'awx.awx.tower_api',
|
'awx.awx.controller_api',
|
||||||
'hosts',
|
'hosts',
|
||||||
query_params={ 'name__endswith' : test_id, },
|
query_params={ 'name__endswith' : test_id, },
|
||||||
) | map(attribute='name') | list }}
|
) | 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') }}"
|
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
|
- name: Test deprecation warnings with legacy name
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: "{{ slack_not }}"
|
name: "{{ slack_not }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
notification_type: slack
|
notification_type: slack
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
- result['deprecations'] | length() == 25
|
- result['deprecations'] | length() == 25
|
||||||
|
|
||||||
- name: Create Slack notification with custom messages
|
- name: Create Slack notification with custom messages
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: "{{ slack_not }}"
|
name: "{{ slack_not }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
notification_type: slack
|
notification_type: slack
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
- result is changed
|
- result is changed
|
||||||
|
|
||||||
- name: Delete Slack notification
|
- name: Delete Slack notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: "{{ slack_not }}"
|
name: "{{ slack_not }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
state: absent
|
state: absent
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
- result is changed
|
- result is changed
|
||||||
|
|
||||||
- name: Add webhook notification
|
- name: Add webhook notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: "{{ webhook_not }}"
|
name: "{{ webhook_not }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
notification_type: webhook
|
notification_type: webhook
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
- result is changed
|
- result is changed
|
||||||
|
|
||||||
- name: Delete webhook notification
|
- name: Delete webhook notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: "{{ webhook_not }}"
|
name: "{{ webhook_not }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
state: absent
|
state: absent
|
||||||
@@ -113,7 +113,7 @@
|
|||||||
- result is changed
|
- result is changed
|
||||||
|
|
||||||
- name: Add email notification
|
- name: Add email notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: "{{ email_not }}"
|
name: "{{ email_not }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
notification_type: email
|
notification_type: email
|
||||||
@@ -134,7 +134,7 @@
|
|||||||
- result is changed
|
- result is changed
|
||||||
|
|
||||||
- name: Copy email notification
|
- name: Copy email notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: "copy_{{ email_not }}"
|
name: "copy_{{ email_not }}"
|
||||||
copy_from: "{{ email_not }}"
|
copy_from: "{{ email_not }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
@@ -145,7 +145,7 @@
|
|||||||
- result.copied
|
- result.copied
|
||||||
|
|
||||||
- name: Delete copied email notification
|
- name: Delete copied email notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: "copy_{{ email_not }}"
|
name: "copy_{{ email_not }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
state: absent
|
state: absent
|
||||||
@@ -156,7 +156,7 @@
|
|||||||
- result is changed
|
- result is changed
|
||||||
|
|
||||||
- name: Delete email notification
|
- name: Delete email notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: "{{ email_not }}"
|
name: "{{ email_not }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
state: absent
|
state: absent
|
||||||
@@ -167,7 +167,7 @@
|
|||||||
- result is changed
|
- result is changed
|
||||||
|
|
||||||
- name: Add twilio notification
|
- name: Add twilio notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: "{{ twillo_not }}"
|
name: "{{ twillo_not }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
notification_type: twilio
|
notification_type: twilio
|
||||||
@@ -184,7 +184,7 @@
|
|||||||
- result is changed
|
- result is changed
|
||||||
|
|
||||||
- name: Delete twilio notification
|
- name: Delete twilio notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: "{{ twillo_not }}"
|
name: "{{ twillo_not }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
state: absent
|
state: absent
|
||||||
@@ -195,7 +195,7 @@
|
|||||||
- result is changed
|
- result is changed
|
||||||
|
|
||||||
- name: Add PagerDuty notification
|
- name: Add PagerDuty notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: "{{ pd_not }}"
|
name: "{{ pd_not }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
notification_type: pagerduty
|
notification_type: pagerduty
|
||||||
@@ -211,7 +211,7 @@
|
|||||||
- result is changed
|
- result is changed
|
||||||
|
|
||||||
- name: Delete PagerDuty notification
|
- name: Delete PagerDuty notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: "{{ pd_not }}"
|
name: "{{ pd_not }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
state: absent
|
state: absent
|
||||||
@@ -222,7 +222,7 @@
|
|||||||
- result is changed
|
- result is changed
|
||||||
|
|
||||||
- name: Add IRC notification
|
- name: Add IRC notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: "{{ irc_not }}"
|
name: "{{ irc_not }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
notification_type: irc
|
notification_type: irc
|
||||||
@@ -241,7 +241,7 @@
|
|||||||
- result is changed
|
- result is changed
|
||||||
|
|
||||||
- name: Delete IRC notification
|
- name: Delete IRC notification
|
||||||
tower_notification_template:
|
notification_template:
|
||||||
name: "{{ irc_not }}"
|
name: "{{ irc_not }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
state: absent
|
state: absent
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
- "result is not changed"
|
- "result is not changed"
|
||||||
|
|
||||||
- name: Create an Instance Group
|
- name: Create an Instance Group
|
||||||
tower_instance_group:
|
instance_group:
|
||||||
name: "{{ group_name1 }}"
|
name: "{{ group_name1 }}"
|
||||||
state: present
|
state: present
|
||||||
register: result
|
register: result
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Delete the instance groups
|
- name: Delete the instance groups
|
||||||
tower_instance_group:
|
instance_group:
|
||||||
name: "{{ group_name1 }}"
|
name: "{{ group_name1 }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
|
|||||||
@@ -158,7 +158,7 @@
|
|||||||
- result is not changed
|
- result is not changed
|
||||||
|
|
||||||
- name: Create a job template that overrides the project scm_branch
|
- name: Create a job template that overrides the project scm_branch
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt1 }}"
|
name: "{{ jt1 }}"
|
||||||
project: "{{ project_name3 }}"
|
project: "{{ project_name3 }}"
|
||||||
inventory: "Demo Inventory"
|
inventory: "Demo Inventory"
|
||||||
@@ -166,7 +166,7 @@
|
|||||||
playbook: debug.yml
|
playbook: debug.yml
|
||||||
|
|
||||||
- name: Launch "{{ jt1 }}"
|
- name: Launch "{{ jt1 }}"
|
||||||
tower_job_launch:
|
job_launch:
|
||||||
job_template: "{{ jt1 }}"
|
job_template: "{{ jt1 }}"
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@
|
|||||||
- result is changed
|
- result is changed
|
||||||
|
|
||||||
- name: "wait for job {{ result.id }}"
|
- name: "wait for job {{ result.id }}"
|
||||||
tower_job_wait:
|
job_wait:
|
||||||
job_id: "{{ result.id }}"
|
job_id: "{{ result.id }}"
|
||||||
register: job
|
register: job
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@
|
|||||||
|
|
||||||
always:
|
always:
|
||||||
- name: Delete the test job_template
|
- name: Delete the test job_template
|
||||||
tower_job_template:
|
job_template:
|
||||||
name: "{{ jt1 }}"
|
name: "{{ jt1 }}"
|
||||||
project: "{{ project_name3 }}"
|
project: "{{ project_name3 }}"
|
||||||
inventory: "Demo Inventory"
|
inventory: "Demo Inventory"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
set_fact:
|
set_fact:
|
||||||
project_base_dir: "{{ tower_settings.project_base_dir }}"
|
project_base_dir: "{{ tower_settings.project_base_dir }}"
|
||||||
vars:
|
vars:
|
||||||
tower_settings: "{{ lookup('awx.awx.tower_api', 'config/') }}"
|
tower_settings: "{{ lookup('awx.awx.controller_api', 'config/') }}"
|
||||||
|
|
||||||
- inventory:
|
- inventory:
|
||||||
name: localhost
|
name: localhost
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
value: "[{{ project_base_dir }}]"
|
value: "[{{ project_base_dir }}]"
|
||||||
|
|
||||||
- name: Create a directory for manual project
|
- name: Create a directory for manual project
|
||||||
tower_ad_hoc_command:
|
ad_hoc_command:
|
||||||
credential: dummy
|
credential: dummy
|
||||||
inventory: localhost
|
inventory: localhost
|
||||||
job_type: run
|
job_type: run
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
- project_create_result is changed
|
- project_create_result is changed
|
||||||
|
|
||||||
- name: Update a project without waiting
|
- name: Update a project without waiting
|
||||||
tower_project_update:
|
project_update:
|
||||||
name: "{{ project_name1 }}"
|
name: "{{ project_name1 }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
wait: false
|
wait: false
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
- result is changed
|
- result is changed
|
||||||
|
|
||||||
- name: Update a project and wait
|
- name: Update a project and wait
|
||||||
tower_project_update:
|
project_update:
|
||||||
name: "{{ project_name1 }}"
|
name: "{{ project_name1 }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
wait: true
|
wait: true
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
- result is successful
|
- result is successful
|
||||||
|
|
||||||
- name: Update a project by ID
|
- name: Update a project by ID
|
||||||
tower_project_update:
|
project_update:
|
||||||
name: "{{ project_create_result.id }}"
|
name: "{{ project_create_result.id }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
wait: true
|
wait: true
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user