This document describes the functionality provided by the XL Release Ansible Tower plugin.
See the XL Release reference manual for background information on XL Release and release automation concepts.
This plugin enables Ansible Tower job execution from XL Release.
- XL Release Server 7+, has been tested with 9.7
- Python requests library as supplied with xlr-xld-plugin
The plugin JAR file can be downloaded from releases.
Copy the downloaded JAR into the SERVER_HOME/plugins/__local__
directory of XL Release.
Define the url, username and password for the Ansible Tower Server in the XL Release shared configuration section.
Define the job template, and optionally the inventory, limit (as comma separated items) and optionally extra variables needed by the job template.
Build and package the plugin with...
./gradlew build
- You will need to have Docker and Docker Compose installed
- The XL-Release image expects to find a valid XL-Release license on your machine, at this location: ~xl-licenses/xl-release-license.lic
- Open a terminal in the root of the xlr-ansible-tower-plugin project and run the test -
./gradlew clean integrationTest
The test will set up a temporary xlr/mockserver testbed using docker. NOTE: The integration tests take about 3 minutes to run.
- The mock server acts as an Ansible Tower server. The mockserver responds to requests with json responses similar to those served by an Ansible Tower server.
- After testing is complete, the test docker containers are stopped and removed.
- For requirements, see the 'To run integration tests' above
- Build the xlr-ansible-tower-plugin.jar - Open a terminal and cd into and run ./gradlew clean build . Be sure to re-run the command whenever code is changed.
- From another terminal, cd into the /src/test/resources/docker/ directory.
- Run (necessary the first time only): docker-compose build
- Then run: docker-compose up -d
- XL Release will run on the localhost port 15516. It may take up to a minute for XL Release to start up
- The XL Release username / password is admin / admin
- After XL Release has started, you can set up a template and shared configuration server by running the script /src/test/resources/docker/initialize/initialize_data.sh. Alternatively, follow the steps below:
- within XL Release->Settings->Shared Configurations, configure an Ansible Tower Server with the following attributes:
- Title -> ansibletower-stub
- Url -> http://ansibletower-stub:5000
- Username -> admin
- Password -> admin
- Within XL Release, navigate to the Templates page and use the import feature to import the template located here: /src/test/resources/docker/initialize/data/release-template.json .
- within XL Release->Settings->Shared Configurations, configure an Ansible Tower Server with the following attributes:
- You can now run a release based the template named 'Ansible Test'.
- When code is modified, re-run the ./gradlew clean build (in the first terminal), then refresh the testbed by running docker-compose down followed by docker-compose up -d (in the second terminal) and after XL Release starts up, re-import the server configuration and the template or configure manually.
Further Demo/Dev Notes:
- The log files will be persisted to the local directory /build/reports/tests/log directory.
- The Mockserver runs on the localhost port 5099
- The mockserver response files used in the demo are located in the /src/test/resources/ansible-stub/responses directory
- If you add response files, be sure to rebuild the mockserver docker image
https://docs.ansible.com/ansible-tower/latest/html/towerapi/api_ref.html