Ansible Tower: Github Integration for Ansible Playbooks

preview_player
Показать описание
Ansible Tower: Github integration for Ansible Playbooks

In this video I show how to integrate playbooks into version control, specifically Github.

Version Control in general allows you to track changes to a directory of files and folders over time, allowing multiple people to make changes, view others changes, merge changes together, and roll back if something goes wrong.

Ansible Tower Version Control Benefits - better organization of your playbooks / content. Multiple people can work on them, make adjustments to the content and it's possible to see who made what changes. A centrally located space for others to more easily work in.

1) Create/use a repo in Github containing your playbooks - note that you'll need a Personal Access Token for private or otherwise access controlled repositories:

1b) Repository with playbooks for this video:

2) If your repository needs authentication as above, in Ansible Tower create a 'Credential' under 'Resources'. This will then be applied when you create a 'Project' and connect your repository to it.

3) Create a new 'Project' in Ansible Tower, with the Github URL, credential (if needed), SCM Type as 'Git'.

4) In the 'Project' section, under 'SCM Update Options', select how you would like Ansible Tower to update the playbook. For example, select 'Update Revision on Launch' to pull in the most recent version of the playbook (from Github into Ansible Tower).

5) Create a new 'Template' in Ansible Tower. In the 'PROJECT' box select the Project name create in #3. This will then populate the 'Playbook' field with the playbooks located in that repository. Set 'Verbosity' higher than 1 to see more of what is going on during playbook run.

6) Set the appropriate credential to connect to your servers. There are many different ways to connect, including password-less (with SSH keys already exchanged and no password required) or other more secure methods.

7) From the 'SCHEDULES' tab add when this playbook should repeat.

8) Ad-hoc run the playbook from the main 'Templates' section, or from the 'Jobs' section.

FYI: There is also the ability to create an inventory that is located in Github as well (though this should be access-controlled).
Рекомендации по теме
Комментарии
Автор

This was great, thanks for the tutorial.

mstevens
Автор

how did your project sync to git hub if you didnt even put any credentials in it ?

xtensionxward
Автор

Not able to see in any playbook into drag down from playbook

harshavardhandeshmukh