mirror of
https://github.com/ansible/awx.git
synced 2026-03-05 18:51:06 -03:30
fixed up jinja2 templating and documentation
This commit is contained in:
@@ -12,7 +12,8 @@ The unit tests are stored in the `test/awx` directory and, where possible, test
|
|||||||
Let's take a closer look at the `test_token.py` file (which tests the `token` module):
|
Let's take a closer look at the `test_token.py` file (which tests the `token` module):
|
||||||
|
|
||||||
```
|
```
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import absolute_import, division, print_function
|
||||||
|
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@@ -27,12 +28,12 @@ def test_create_token(run_module, admin_user):
|
|||||||
'description': 'barfoo',
|
'description': 'barfoo',
|
||||||
'state': 'present',
|
'state': 'present',
|
||||||
'scope': 'read',
|
'scope': 'read',
|
||||||
'tower_host': None,
|
'controller_host': None,
|
||||||
'tower_username': None,
|
'controller_username': None,
|
||||||
'tower_password': None,
|
'controller_password': None,
|
||||||
'validate_certs': None,
|
'validate_certs': None,
|
||||||
'tower_oauthtoken': None,
|
'controller_oauthtoken': None,
|
||||||
'tower_config_file': None,
|
'controller_config_file': None,
|
||||||
}
|
}
|
||||||
|
|
||||||
result = run_module('token', module_args, admin_user)
|
result = run_module('token', module_args, admin_user)
|
||||||
@@ -97,7 +98,7 @@ While not strictly followed, the general flow of a test should be:
|
|||||||
```
|
```
|
||||||
- name: Try to use a token as a dict which is missing the token parameter
|
- name: Try to use a token as a dict which is missing the token parameter
|
||||||
job_list:
|
job_list:
|
||||||
tower_oauthtoken:
|
controller_oauthtoken:
|
||||||
not_token: "This has no token entry"
|
not_token: "This has no token entry"
|
||||||
register: results
|
register: results
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
@@ -105,7 +106,7 @@ While not strictly followed, the general flow of a test should be:
|
|||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- results is failed
|
- results is failed
|
||||||
- '"The provided dict in tower_oauthtoken did not properly contain the token entry" == results.msg'
|
- '"The provided dict in controller_oauthtoken did not properly contain the token entry" == results.msg'
|
||||||
```
|
```
|
||||||
|
|
||||||
- **`Block:`**
|
- **`Block:`**
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: tower_{{ singular_item_type }}
|
module: {{ singular_item_type }}
|
||||||
author: "John Westcott IV (@john-westcott-iv)"
|
author: "John Westcott IV (@john-westcott-iv)"
|
||||||
version_added: "4.0.0"
|
version_added: "4.0.0"
|
||||||
short_description: create, update, or destroy Ansible Tower {{ human_readable }}.
|
short_description: create, update, or destroy Automation Platform Controller {{ human_readable }}.
|
||||||
description:
|
description:
|
||||||
- Create, update, or destroy Ansible Tower {{ human_readable }}. See
|
- Create, update, or destroy Automation Platform Controller {{ human_readable }}. See
|
||||||
U(https://www.ansible.com/tower) for an overview.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
options:
|
options:
|
||||||
{% for option in item['json']['actions']['POST'] %}
|
{% for option in item['json']['actions']['POST'] %}
|
||||||
@@ -37,12 +37,12 @@ options:
|
|||||||
{% if 'help_text' in item['json']['actions']['POST'][option] %}
|
{% if 'help_text' in item['json']['actions']['POST'][option] %}
|
||||||
- {{ item['json']['actions']['POST'][option]['help_text'] }}
|
- {{ item['json']['actions']['POST'][option]['help_text'] }}
|
||||||
{% else %}
|
{% else %}
|
||||||
- NO DESCRIPTION GIVEN IN THE TOWER API
|
- NO DESCRIPTION GIVEN IN THE API
|
||||||
{% endif %}
|
{% endif %}
|
||||||
required: {{ item['json']['actions']['POST'][option]['required'] }}
|
required: {{ item['json']['actions']['POST'][option]['required'] }}
|
||||||
type: {{ type_map[ item['json']['actions']['POST'][option]['type'] ] }}
|
type: {{ type_map[ item['json']['actions']['POST'][option]['type'] ] }}
|
||||||
{% if 'default' in item['json']['actions']['POST'][option] %}
|
{% if 'default' in item['json']['actions']['POST'][option] %}
|
||||||
{# for tower_job_template/extra vars, its type is dict but its default is '', so we want to make that {} #}
|
{# for job_template/extra vars, its type is dict but its default is '', so we want to make that {} #}
|
||||||
{% if item['json']['actions']['POST'][option]['default'] == '' and type_map[ item['json']['actions']['POST'][option]['type'] ] == 'dict' %}
|
{% if item['json']['actions']['POST'][option]['default'] == '' and type_map[ item['json']['actions']['POST'][option]['type'] ] == 'dict' %}
|
||||||
default: {}
|
default: {}
|
||||||
{% else %}
|
{% else %}
|
||||||
@@ -82,9 +82,9 @@ options:
|
|||||||
choices: ["present", "absent"]
|
choices: ["present", "absent"]
|
||||||
default: "present"
|
default: "present"
|
||||||
type: str
|
type: str
|
||||||
tower_oauthtoken:
|
controller_oauthtoken:
|
||||||
description:
|
description:
|
||||||
- The Tower OAuth token to use.
|
- The OAuth token to use.
|
||||||
required: False
|
required: False
|
||||||
type: str
|
type: str
|
||||||
extends_documentation_fragment: awx.awx.auth
|
extends_documentation_fragment: awx.awx.auth
|
||||||
|
|||||||
@@ -76,11 +76,13 @@ Notable releases of the `{{ collection_namespace }}.{{ collection_package }}` co
|
|||||||
- 0.0.1-devel is the version you should see if installing from source, which is intended for development and expected to be unstable.
|
- 0.0.1-devel is the version you should see if installing from source, which is intended for development and expected to be unstable.
|
||||||
{% else %}
|
{% else %}
|
||||||
- 3.7.0 initial release
|
- 3.7.0 initial release
|
||||||
|
- 4.0.0 ansible.tower renamed to ansible.controller
|
||||||
|
- tower_ prefix is dropped from the module names, e.g. tower_inventory becomes inventory
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
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.
|
- The module tower_notification was renamed tower_notification_template. In ansible >= 2.10 there is a seamless redirect. Ansible 2.9 does not respect the redirect.
|
||||||
- When a project is created, it will wait for the update/sync to finish by default; this can be turned off with the `wait` parameter, if desired.
|
- When a project is created, it will wait for the update/sync to finish by default; this can be turned off with the `wait` parameter, if desired.
|
||||||
- Creating a "scan" type job template is no longer supported.
|
- 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.
|
||||||
|
|||||||
@@ -4,10 +4,13 @@ associations:
|
|||||||
- related_item: credentials
|
- related_item: credentials
|
||||||
endpoint: credentials
|
endpoint: credentials
|
||||||
description: "The credentials used by this job template"
|
description: "The credentials used by this job template"
|
||||||
|
required: False
|
||||||
groups:
|
groups:
|
||||||
- related_item: hosts
|
- related_item: hosts
|
||||||
endpoint: hosts
|
endpoint: hosts
|
||||||
description: "The hosts associated with this group"
|
description: "The hosts associated with this group"
|
||||||
|
required: False
|
||||||
- related_item: groups
|
- related_item: groups
|
||||||
endpoint: children
|
endpoint: children
|
||||||
description: "The hosts associated with this group"
|
description: "The hosts associated with this group"
|
||||||
|
required: False
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ examples:
|
|||||||
first_name: John
|
first_name: John
|
||||||
last_name: Doe
|
last_name: Doe
|
||||||
state: present
|
state: present
|
||||||
tower_config_file: "~/tower_cli.cfg"
|
controller_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
- name: Add user as a system administrator
|
- name: Add user as a system administrator
|
||||||
user:
|
user:
|
||||||
@@ -18,7 +18,7 @@ examples:
|
|||||||
email: jdoe@example.org
|
email: jdoe@example.org
|
||||||
superuser: yes
|
superuser: yes
|
||||||
state: present
|
state: present
|
||||||
tower_config_file: "~/tower_cli.cfg"
|
controller_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
- name: Add user as a system auditor
|
- name: Add user as a system auditor
|
||||||
user:
|
user:
|
||||||
@@ -27,14 +27,14 @@ examples:
|
|||||||
email: jdoe@example.org
|
email: jdoe@example.org
|
||||||
auditor: yes
|
auditor: yes
|
||||||
state: present
|
state: present
|
||||||
tower_config_file: "~/tower_cli.cfg"
|
controller_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
- name: Delete user
|
- name: Delete user
|
||||||
user:
|
user:
|
||||||
username: jdoe
|
username: jdoe
|
||||||
email: jdoe@example.org
|
email: jdoe@example.org
|
||||||
state: absent
|
state: absent
|
||||||
tower_config_file: "~/tower_cli.cfg"
|
controller_config_file: "~/tower_cli.cfg"
|
||||||
|
|
||||||
job_templates: |
|
job_templates: |
|
||||||
- name: Create Ping job template
|
- name: Create Ping job template
|
||||||
@@ -46,6 +46,6 @@ examples:
|
|||||||
playbook: "ping.yml"
|
playbook: "ping.yml"
|
||||||
credential: "Local"
|
credential: "Local"
|
||||||
state: "present"
|
state: "present"
|
||||||
tower_config_file: "~/tower_cli.cfg"
|
controller_config_file: "~/tower_cli.cfg"
|
||||||
survey_enabled: yes
|
survey_enabled: yes
|
||||||
survey_spec: "{{ '{{' }} lookup('file', 'my_survey.json') {{ '}}' }}"
|
survey_spec: "{{ '{{' }} lookup('file', 'my_survey.json') {{ '}}' }}"
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
---
|
---
|
||||||
name_to_id_endpoint_resolution:
|
name_to_id_endpoint_resolution:
|
||||||
webhook_credential: credentials
|
webhook_credential: credentials
|
||||||
project: projects
|
credential: credentials
|
||||||
|
credential_type: credential_types
|
||||||
|
default_environment: execution_environments
|
||||||
|
execution_environment: execution_environments
|
||||||
inventory: inventories
|
inventory: inventories
|
||||||
organization: organizations
|
organization: organizations
|
||||||
credential: credentials
|
project: projects
|
||||||
|
source_project: projects
|
||||||
|
team: teams
|
||||||
|
unified_job_template: unified_job_templates
|
||||||
|
user: users
|
||||||
|
|||||||
Reference in New Issue
Block a user