Ansible : AWX : Add Job Templates2022/02/24
This is the basic configuration for Ansible AWX to run Ansible Playbooks.
To run Playbooks on target Hosts on AWX, it needs to configure the following settings.
* Add inventories
* Add credentials
* Add projects
* Add job templates
To add job templates, configure like follows.
Before it, it needs to prepare Playbooks on Source Control repository you set on the project you added like here.
This example is based on the environment that Git repository is set with HTTP access enabled for the Source Control.
|||Create a Playbook on Source Control repository that you'd like to execute on target Hosts from AWX.
If you set Git repository like this example, refer to follows as a way to create Playbooks.
# move to working directory
# create a test Playbook
# create new
# for example, touch a file [/tmp/helloworld.txt] with 644 on target Hosts
# for [hosts] value, specify the group name you set on an inventory you added
# ⇒ example [hosts] value below, that is the group name set on here of 
--- - hosts: CentOS tasks: - name: Test Task file: path: /tmp/helloworld.txt state: touch owner: root group: root mode: 644
# push to repository
git add helloworld.yml
git commit helloworld.yml -m "Initial Commit"
git remote -v
origin http://firstname.lastname@example.org/git/project01.git (fetch) origin http://email@example.com/git/project01.git (push)[cent@dlp project01]$
git push origin master
|||When you create new Playbooks on the repository set as Source Control, it needs to sync them with AWX.
Login to Ansible AWX Web and click [Projects] on the left pane and open the project you added, and then, click [Sync] button to import new Playbooks.
|||Add job templates, Click [Templates] on the left pane.|
|||Click [Add] - [Add job template] on the right pane.|
Input basic information for job template and click [Save] button to save.
|||After Saving template, that's OK if following screen is shown.|
|||After adding a job template, That's OK if template is displayed on [Templates] list.|