This plugin gives you the ability to run Ansible Tower jobs as a build step.
Jenkins Wiki page: TBD
On the Jenkins => Manage Jenkins => Configure System you will find an Ansible Tower section where you can add a connection to an Ansible Tower server.
Tower jobs can be executed from workflow scripts. The towerServer and jobTemplate are the only required parameters. G
steps {
ansibleTower(
towerServer: 'Prod Tower',
jobTemplate: 'Simple Test',
importTowerLogs: true,
inventory: 'Demo Inventory',
jobTags: '',
limit: '',
removeColor: false,
verbose: true,
credential: '',
extraVars: '''---
my_var: "Jenkins Test"'''
)
}
You need to install the AnsiColor plugin to output a colorized Ansible log.
node {
wrap([$class: 'AnsiColorBuildWrapper', colorMapName: "xterm"]) {
ansibleTower(
towerServer: 'Prod Tower',
jobTemplate: 'Simple Test',
importTowerLogs: true,
inventory: 'Demo Inventory',
jobTags: '',
limit: '',
removeColor: false,
verbose: true,
credential: '',
extraVars: '''---
my_var: "Jenkins Test"'''
)
}
}
If you dont have AnsiColor or want to remove the color from the log set removeColor: true.