Ansible playbooks and roles must be kept in the Git repositories. Git provides a great mechanism to track the changes in the source code (i.e Playbooks). It also allows playbook developers to create a new branch and work on the codes without impacting the production. Ansible offers an option to pull the new codes on each template run if there are new changes committed in git. Let’s walk through Ansible Tower /AWX – Git SCM project setup and creating the template using that.
1. Login to Ansible Tower / AWX console.
2. Here is the sample GitLab project which is going to be used to set up the Ansible Project. Playbook will always refer the current directory “roles” directory to find the referred role.
3. Navigate to the projects tab and click on “+” in AWX/Ansible Tower console.
4. Enter the project details and select SCM as git.
5. Once you have saved the project, it will try to update it from git SCM.
6. If you create a new template, you could call the playbook from Git SCM. Here is the sample template by using the Git SCM project.
Source control (git or Subversion) based project provides great protection against accidential playbook changes. Hope this article is informative to you.
Share it ! Comment it !! Be Sociable !!!
Chari says
Hi All!
I”m getting below error while. configuring Project in ansible awx for GitLab repository access.
fatal: unable to access ‘https://$encrypted:$encrypted$pwforge.pathcom/awxprojects/forti-project.git/’: Failed connect to pwforge.pathcom.com:443
Lingeswaran R says
You might need to use Git token instead of a password.
Thank you
Lingesh
jonny says
This would be more useful if the source for the files in your oc_deploy_automation were available. With the content as it is we have to guess hwo it is structured.