Ansible : AWX : Add Job Templates2023/08/01
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
To add job templates, configure like follows.
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: Debian tasks: - name: Test Task file: path: /tmp/helloworld.txt state: touch owner: root group: root mode: 0644
# push to repository
git add helloworld.yml
git commit helloworld.yml -m "Initial Commit"
git remote -v
origin http://email@example.com/git/project01.git (fetch) origin http://firstname.lastname@example.org/git/project01.git (push)debian@dlp:~/work/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.|