XL Release Ansible Tower Plugin
[
]()
Preface
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.
Overview
This plugin enables Ansible Tower job execution from XL Release.
Requirements
- XL Release Server 7+, has been tested with 9.7
- Python requests library as supplied with xlr-xld-plugin
Installation
The plugin JAR file can be downloaded from releases.
Copy the downloaded JAR into the SERVER_HOME/plugins/__local__
directory of XL Release.
Usage
Ansible Tower Server
Define the url, username and password for the Ansible Tower Server in the XL Release shared configuration section.
![AnsibleTowerCfg](https://github.com/xebialabs-community/xlr-ansible-tower-plugin/raw/master/images/tower_cfg.png)
Launch Job Task
Define the job template, and optionally the inventory, limit (as comma separated items) and optionally extra variables needed by the job template.
![AnsibleTowerLaunchJob](https://github.com/xebialabs-community/xlr-ansible-tower-plugin/raw/master/images/launch_job.png)
Synchronize Inventory Task
![AnsibleTowerSyncJob](https://github.com/xebialabs-community/xlr-ansible-tower-plugin/raw/master/images/syncInventory.png)
Develop and Demo
Build and package the plugin with...
./gradlew build
To run integration tests -
- 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.
To run demo or dev version (set up the docker containers and leave them running) -
- 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 .
- 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
References
https://docs.ansible.com/ansible-tower/latest/html/towerapi/api_ref.html