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.
|
|
[1] | 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. |
# 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 [6] --- - hosts: CentOS tasks: - name: Test Task file: path: /tmp/helloworld.txt state: touch owner: root group: root mode: 644 # push to repository [cent@dlp project01]$ git add helloworld.yml [cent@dlp project01]$ git commit helloworld.yml -m "Initial Commit" [cent@dlp project01]$ git remote -v origin http://cent@dlp.srv.world/git/project01.git (fetch) origin http://cent@dlp.srv.world/git/project01.git (push)[cent@dlp project01]$ git push origin master |
[2] | 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. |
[3] | Add job templates, Click [Templates] on the left pane. |
[4] | Click [Add] - [Add job template] on the right pane. |
[5] |
Input basic information for job template and click [Save] button to save.
|
[6] | After Saving template, that's OK if following screen is shown. |
[6] | After adding a job template, That's OK if template is displayed on [Templates] list. |
Sponsored Link |
|