mirror of
https://github.com/ansible/awx.git
synced 2026-05-14 04:47:44 -02:30
controller_meta, templating
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# AWX Ansible Collection
|
# Tower Ansible Collection
|
||||||
|
|
||||||
[comment]: # (*******************************************************)
|
[comment]: # (*******************************************************)
|
||||||
[comment]: # (* *)
|
[comment]: # (* *)
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
[comment]: # (* upon build of the collection *)
|
[comment]: # (* upon build of the collection *)
|
||||||
[comment]: # (*******************************************************)
|
[comment]: # (*******************************************************)
|
||||||
|
|
||||||
This Ansible collection allows for easy interaction with an AWX server via Ansible playbooks.
|
This Ansible collection allows for easy interaction with an Ansible Tower server via Ansible playbooks.
|
||||||
|
|
||||||
This source for this collection lives in the `awx_collection` folder inside of the
|
This source for this collection lives in the `awx_collection` folder inside of the
|
||||||
AWX source.
|
AWX source.
|
||||||
@@ -22,12 +22,7 @@ doc fragment.
|
|||||||
|
|
||||||
## Building and Installing
|
## Building and Installing
|
||||||
|
|
||||||
This collection templates the `galaxy.yml` file it uses.
|
This collection should be installed from [Content Hub](https://cloud.redhat.com/ansible/automation-hub/ansible/tower/)
|
||||||
Run `make build_collection` from the root folder of the AWX source tree.
|
|
||||||
This will create the `tar.gz` file inside the `awx_collection` folder
|
|
||||||
with the current AWX version, for example: `awx_collection/awx-awx-9.2.0.tar.gz`.
|
|
||||||
|
|
||||||
Installing the `tar.gz` involves no special instructions.
|
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
|
|
||||||
@@ -63,11 +58,9 @@ oauth_token = LEdCpKVKc4znzffcpQL5vLG8oyeku6
|
|||||||
|
|
||||||
## Release and Upgrade Notes
|
## Release and Upgrade Notes
|
||||||
|
|
||||||
Notable releases of the `awx.awx` collection:
|
Notable releases of the `ansible.controller` collection:
|
||||||
|
|
||||||
- 7.0.0 is intended to be identical to the content prior to the migration, aside from changes necessary to function as a collection.
|
- 3.7.0 initial release
|
||||||
- 11.0.0 has no non-deprecated modules that depend on the deprecated `tower-cli` [PyPI](https://pypi.org/project/ansible-tower-cli/).
|
|
||||||
- 0.0.1-devel is the version you should see if installing from source, which is intended for development and expected to be unstable.
|
|
||||||
|
|
||||||
The following notes are changes that may require changes to playbooks:
|
The following notes are changes that may require changes to playbooks:
|
||||||
|
|
||||||
@@ -96,38 +89,6 @@ The following notes are changes that may require changes to playbooks:
|
|||||||
- `tower_credential` no longer supports passing a file name to ssh_key_data.
|
- `tower_credential` no longer supports passing a file name to ssh_key_data.
|
||||||
- The HipChat `notification_type` has been removed and can no longer be created using the `tower_notification_template` module.
|
- The HipChat `notification_type` has been removed and can no longer be created using the `tower_notification_template` module.
|
||||||
|
|
||||||
## Running Unit Tests
|
|
||||||
|
|
||||||
Tests to verify compatibility with the most recent AWX code are in `awx_collection/test/awx`.
|
|
||||||
These can be ran by `make test_collection` in the development container.
|
|
||||||
|
|
||||||
To run outside of the development container, or to run against
|
|
||||||
Ansible source, set up a working environment:
|
|
||||||
|
|
||||||
```
|
|
||||||
mkvirtualenv my_new_venv
|
|
||||||
# may need to replace psycopg2 with psycopg2-binary in requirements/requirements.txt
|
|
||||||
pip install -r requirements/requirements.txt -r requirements/requirements_dev.txt -r requirements/requirements_git.txt
|
|
||||||
make clean-api
|
|
||||||
pip install -e <path to your Ansible>
|
|
||||||
pip install -e .
|
|
||||||
pip install -e awxkit
|
|
||||||
py.test awx_collection/test/awx/
|
|
||||||
```
|
|
||||||
|
|
||||||
## Running Integration Tests
|
|
||||||
|
|
||||||
The integration tests require a virtualenv with `ansible` >= 2.9 and `awxkit`.
|
|
||||||
The collection must first be installed, which can be done using `make install_collection`.
|
|
||||||
You also need a configuration file, as described in the running section.
|
|
||||||
|
|
||||||
Run the tests:
|
|
||||||
|
|
||||||
```
|
|
||||||
# ansible-test must be run from the directory in which the collection is installed
|
|
||||||
cd ~/.ansible/collections/ansible_collections/awx/awx/
|
|
||||||
ansible-test integration
|
|
||||||
```
|
|
||||||
|
|
||||||
## Licensing
|
## Licensing
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ homepage: https://www.ansible.com/
|
|||||||
issues: https://github.com/ansible/awx/issues?q=is%3Aissue+label%3Acomponent%3Aawx_collection
|
issues: https://github.com/ansible/awx/issues?q=is%3Aissue+label%3Acomponent%3Aawx_collection
|
||||||
license:
|
license:
|
||||||
- GPL-3.0-only
|
- GPL-3.0-only
|
||||||
name: awx
|
name: controller
|
||||||
namespace: awx
|
namespace: ansible
|
||||||
readme: README.md
|
readme: README.md
|
||||||
repository: https://github.com/ansible/awx
|
repository: https://github.com/ansible/awx
|
||||||
tags:
|
tags:
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ plugin_routing:
|
|||||||
tower_settings:
|
tower_settings:
|
||||||
redirect: settings
|
redirect: settings
|
||||||
tower_meta:
|
tower_meta:
|
||||||
redirect: meta
|
redirect: controller_meta
|
||||||
tower_export:
|
tower_export:
|
||||||
redirect: export
|
redirect: export
|
||||||
tower_ad_hoc_command_cancel:
|
tower_ad_hoc_command_cancel:
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
|
|||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: meta
|
module: controller_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 = '''
|
||||||
- meta:
|
- controller_meta:
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Show details about the collection
|
- name: Show details about the collection
|
||||||
@@ -66,7 +66,7 @@ from ..module_utils.controller_api import ControllerAPIModule
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = ControllerAPIModule(argument_spec={})
|
module = ControllerAPIModule(argument_spec={})
|
||||||
namespace = {'awx': 'awx', 'tower': 'ansible'}.get(module._COLLECTION_TYPE, 'unknown')
|
namespace = {'awx': 'awx', 'controller': 'ansible'}.get(module._COLLECTION_TYPE, 'unknown')
|
||||||
namespace_name = '{0}.{1}'.format(namespace, module._COLLECTION_TYPE)
|
namespace_name = '{0}.{1}'.format(namespace, module._COLLECTION_TYPE)
|
||||||
module.exit_json(prefix=namespace_name, name=module._COLLECTION_TYPE, namespace=namespace, version=module._COLLECTION_VERSION)
|
module.exit_json(prefix=namespace_name, name=module._COLLECTION_TYPE, namespace=namespace, version=module._COLLECTION_VERSION)
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ no_module_for_endpoint = []
|
|||||||
# Some modules work on the related fields of an endpoint. These modules will not have an auto-associated endpoint
|
# 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 = [
|
||||||
'import',
|
'import',
|
||||||
'meta',
|
'controller_meta',
|
||||||
'export',
|
'export',
|
||||||
'inventory_source_update',
|
'inventory_source_update',
|
||||||
'job_launch',
|
'job_launch',
|
||||||
@@ -170,7 +170,7 @@ def test_completeness(collection_import, request, admin_user, job_template, exec
|
|||||||
if root == module_directory:
|
if root == module_directory:
|
||||||
for filename in files:
|
for filename in files:
|
||||||
# must begin with a letter a-z, and end in .py
|
# must begin with a letter a-z, and end in .py
|
||||||
if re.match('^[a-z].*\.py$', filename):
|
if re.match(r'^[a-z].*.py$', filename):
|
||||||
module_name = filename[:-3]
|
module_name = filename[:-3]
|
||||||
option_comparison[module_name] = {
|
option_comparison[module_name] = {
|
||||||
'endpoint': 'N/A',
|
'endpoint': 'N/A',
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
group_name: "AWX-Collection-tests-tower_api_lookup-group1-{{ test_id }}"
|
group_name: "AWX-Collection-tests-tower_api_lookup-group1-{{ test_id }}"
|
||||||
|
|
||||||
- name: Get our collection package
|
- name: Get our collection package
|
||||||
meta:
|
controller_meta:
|
||||||
register: tower_meta
|
register: tower_meta
|
||||||
|
|
||||||
- name: Generate the name of our plugin
|
- name: Generate the name of our plugin
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: Get our collection package
|
- name: Get our collection package
|
||||||
meta:
|
controller_meta:
|
||||||
register: tower_meta
|
register: tower_meta
|
||||||
|
|
||||||
- name: Generate the name of our plugin
|
- name: Generate the name of our plugin
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
- 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:
|
||||||
oauthtoken:
|
tower_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
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
- name: Try to use a token as a list
|
- name: Try to use a token as a list
|
||||||
job_list:
|
job_list:
|
||||||
oauthtoken:
|
tower_oauthtoken:
|
||||||
- dummy_token
|
- dummy_token
|
||||||
register: results
|
register: results
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
plugins/modules/tower_receive.py validate-modules:deprecation-mismatch
|
plugins/modules/receive.py validate-modules:deprecation-mismatch
|
||||||
plugins/modules/tower_send.py validate-modules:deprecation-mismatch
|
plugins/modules/send.py validate-modules:deprecation-mismatch
|
||||||
plugins/modules/tower_workflow_template.py validate-modules:deprecation-mismatch
|
plugins/modules/workflow_template.py validate-modules:deprecation-mismatch
|
||||||
plugins/modules/tower_credential.py pylint:wrong-collection-deprecated-version-tag
|
plugins/modules/credential.py pylint:wrong-collection-deprecated-version-tag
|
||||||
plugins/modules/tower_job_wait.py pylint:wrong-collection-deprecated-version-tag
|
plugins/modules/job_wait.py pylint:wrong-collection-deprecated-version-tag
|
||||||
plugins/modules/tower_notification_template.py pylint:wrong-collection-deprecated-version-tag
|
plugins/modules/notification_template.py pylint:wrong-collection-deprecated-version-tag
|
||||||
plugins/inventory/tower.py pylint:raise-missing-from
|
plugins/inventory/controller.py pylint:raise-missing-from
|
||||||
plugins/inventory/tower.py pylint:super-with-arguments
|
plugins/inventory/controller.py pylint:super-with-arguments
|
||||||
plugins/lookup/tower_schedule_rrule.py pylint:raise-missing-from
|
plugins/lookup/schedule_rrule.py pylint:raise-missing-from
|
||||||
plugins/module_utils/tower_api.py pylint:super-with-arguments
|
plugins/module_utils/controller_api.py pylint:super-with-arguments
|
||||||
plugins/module_utils/tower_awxkit.py pylint:super-with-arguments
|
plugins/module_utils/awxkit.py pylint:super-with-arguments
|
||||||
plugins/module_utils/tower_legacy.py pylint:super-with-arguments
|
plugins/module_utils/tower_legacy.py pylint:super-with-arguments
|
||||||
plugins/module_utils/tower_module.py pylint:super-with-arguments
|
plugins/module_utils/controller_module.py pylint:super-with-arguments
|
||||||
plugins/module_utils/tower_module.py pylint:raise-missing-from
|
plugins/module_utils/controller_module.py pylint:raise-missing-from
|
||||||
test/awx/conftest.py pylint:raise-missing-from
|
test/awx/conftest.py pylint:raise-missing-from
|
||||||
plugins/module_utils/tower_api.py pep8:E203
|
plugins/module_utils/controller_api.py pep8:E203
|
||||||
|
|||||||
@@ -24,15 +24,15 @@
|
|||||||
with_fileglob:
|
with_fileglob:
|
||||||
- "{{ collection_path }}/plugins/inventory/*.py"
|
- "{{ collection_path }}/plugins/inventory/*.py"
|
||||||
- "{{ collection_path }}/plugins/lookup/*.py"
|
- "{{ collection_path }}/plugins/lookup/*.py"
|
||||||
- "{{ collection_path }}/plugins/modules/tower_*.py"
|
- "{{ collection_path }}/plugins/modules/*.py"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item | basename }}"
|
label: "{{ item | basename }}"
|
||||||
|
|
||||||
- name: Change inventory file to support desired namespace and package names
|
- name: Change inventory file to support desired namespace and package names
|
||||||
replace:
|
replace:
|
||||||
path: "{{ collection_path }}/plugins/inventory/controller.py"
|
path: "{{ collection_path }}/plugins/inventory/controller.py"
|
||||||
regexp: "^ NAME = 'awx.awx.tower' # REPLACE$"
|
regexp: "^ NAME = 'awx.awx.controller' # REPLACE$"
|
||||||
replace: " NAME = '{{ collection_namespace }}.{{ collection_package }}.tower' # REPLACE"
|
replace: " NAME = '{{ collection_namespace }}.{{ collection_package }}.controller' # REPLACE"
|
||||||
|
|
||||||
- name: get list of test files
|
- name: get list of test files
|
||||||
find:
|
find:
|
||||||
|
|||||||
Reference in New Issue
Block a user