How to Run and Schedule Available Playbook Using AWX GUI

 

Our earlier article we had already demonstrated the set up steps of Ansible AWX on CentOS Eight and RHEL 8. Ansible AWX is free and open supply model Pink Hat Ansible Tower. It supplies a Graphical person interface, Relaxation API and Ansible activity engine.

On this article we’ll via some lights on the fundamental utilization of Ansible AWX GUI and the way we will run and schedule Ansible Playbooks utilizing this device.

Lab Particulars for AWX GUI,

  • 192.168.1.6     // Already Put in Ansible AWX system (CentOS 8)
  • 192.168.1.9    // Ansible Consumer (CentOS 7)
  • 192.168.1.10   // Ansible Consumer (Ubuntu 18.04)
  • Time Synching of all of the machines with NTP Servers
  • sysadm person with sudo rights

Let’s leap into the steps of AWX primary Utilization and operating Ansible playbooks by way of AWX GUI,

Step 1) Setup Keys primarily based authentication amongst Ansible AWX Node and its shoppers

As we’re utilizing sysadm person, so we will likely be exchanging the ssh keys of this person from Ansbile AWX system to ansible shoppers.

I’m assuming sysadm person is already created on these methods and have the sudo rights. Use under instructions to generate SSH keys for sysadm person from AWX Node and share its public keys to ansible shoppers utilizing ssh-copy-id command,

[[email protected] ~]$ ssh-keygen

How to Run and Schedule Available Playbook Using AWX GUI

Now copy the general public key of sysadm person to shoppers

[[email protected] ~]$ ssh-copy-id [email protected]
[[email protected] ~]$ ssh-copy-id [email protected]

Confirm Whether or not Keys primarily based authentication has been setup correctly or not, run the next instructions,

[[email protected] ~]$ ssh  [email protected] “hostname;exit”
centos7
[[email protected] ~]$ ssh  [email protected] “hostname;exit”
Ubuntu-18-04
[[email protected] ~]$

Step 2) Create an Group in AWX GUI

Login to Ansible AWX GUI and go to Group Tab and create a company by clicking on “+” image,

How to Run and Schedule Available Playbook Using AWX GUI

Subsequent we will likely be prompted to enter Group Identify,

How to Run and Schedule Available Playbook Using AWX GUI

Click on on Save

Step 3) Create a Undertaking and Assign Group to it

Earlier than making a mission, let’s first create mission’s listing the place we’ll retailer all ansible playbooks, go to cli console of AWX node and run,

[[email protected] ~]$ sudo mkdir /var/lib/awx/tasks/automation

Now Create a pattern playbook to put in bind-utils packages on CentOS and Ubuntu Techniques,

[[email protected] ~]$ cd /var/lib/awx/tasks/automation/
[[email protected] automation]$ sudo vi instance.yaml

– hosts: all
gather_facts: true
turn into: true
duties:
– yum:
identify: bind-utils
when: ansible_os_family == “RedHat”
– apt:
identify: dnsutils
when: ansible_os_family == “Debian”

Save and exit the file,

Now Go to AWX GUI, Choose Tasks Tab after which click on on + signal to create a brand new Undertaking and specify the identify of mission that fits to your setup and specify different particulars like Organizations as “LINUXTECHI”, SCM Kind as “Guide”, Undertaking Base Path as “/var/lib/tasks” and Playbook Listing as “automation”

How to Run and Schedule Available Playbook Using AWX GUI

Click on on Save

Step 4) Create Credentials and add non-public key and different particulars

These credentials will likely be used whereas executing the playbooks on course ansible shoppers. To get contents of SSH non-public key of sysadm person, run the next command:

[[email protected] ~]$ cat ~/.ssh/id_rsa

Now, Choose Credentials Tab and Click on on ‘+’ signal to create credentials and select Credentials sort as “Machine“, Select Group as “LINUXTECHI“, Username as “sysadm” and Paste Non-public Key of sysadm person in “SSH Non-public Key” Part, Select ‘Privilege Escalation Methodology‘ as ‘sudo‘, ‘Privilege Escalation Username‘ as ‘sysadm‘ and ‘Privilege Escalation Password’ as {password-of-sysadm-user}

How to Run and Schedule Available Playbook Using AWX GUI

Click on on SAVE,

Step 5) Create an Stock, add hosts to it and run ping module

To Create a list, Choose the Stock Tab after which click on on + signal and specify the identify of Stock and select group as “LINUXTECHI“,

How to Run and Schedule Available Playbook Using AWX GUI

To Add hosts to Frontend Stock, Select SAVE possibility in above window then Click on on HOSTS and the Click on on ‘+’ image to start out including hosts, Specify the IP ADDRESS or Host identify within the “HOST NAME” subject after which click on on save.

How to Run and Schedule Available Playbook Using AWX GUI

Equally add one other host “192.168.1.10”.

Let’s attempt to run ping module on one of many hosts to confirm connectivity and credentials. Select any of the host from stock and the press on “RUN COMMANDS”

How to Run and Schedule Available Playbook Using AWX GUI

Within the subsequent window, select ‘ping‘ from module part and Select “automation credentials”  from Machine Credentials,

How to Run and Schedule Available Playbook Using AWX GUI

Click on on Launch after which we’ll get following display,

How to Run and Schedule Available Playbook Using AWX GUI

Good, above window confirms that Connectivity and credentials are working fantastic. Let’s transfer to the following step and create templates.

Step 5) Create and Run Job Template

To Create Job Template, select “Template” Tab and the press on + signal and Select “Job Template”

Specify the followings as:

  • NAME : PKG Set up
  • Description : Set up Bind Utils PKG
  • JOB TYPE : Run
  • INVENTORY : Frontend
  • PROJECT : Automation
  • PLAYBOOK : instance.yaml
  • CREDENTIALS : automation credentials
  • Select “ENABLE PRIVILEGE ESCALATION”

How to Run and Schedule Available Playbook Using AWX GUI

Click on on SAVE

Now attempt to Run the Job and see whether or not Job is executed is efficiently, right here execution of Job is nothing however Ansible playbook execution on stock utilizing the credentials that we’ve got created in above steps.

Choose the Job as “PKG Set up” and the press on Rocket Image to run the Job,

How to Run and Schedule Available Playbook Using AWX GUI

We are going to get the next display, if Job or Ansible Playbook is executed efficiently then we must always get success message.

How to Run and Schedule Available Playbook Using AWX GUI

Nice, Job was executed efficiently, let schedule this job.

Step 6) Scheduling Job Template

Select the Job Template which you need to schedule, in my case it might be “PKG Set up” and the select “SCHEDULES” possibility and the press on + signal to create a brand new schedule,

Let’s Assume we need to create a schedule in such a method that Job will likely be executed day-after-day at 16:00 Hours until 30th April,

How to Run and Schedule Available Playbook Using AWX GUI

Click on on Save to allow this schedule for Job Template “PKG Set up“.

How to Run and Schedule Available Playbook Using AWX GUI

That’s all from this text, I hope these steps helps to grasp the fundamental utilization of Ansible AWX GUI and the way Ansible Playbooks are executed by way of Job template. Please don’t hesitate to share your suggestions and feedback.

ui to run ansible playbooks,ansible awx,ansible gui,ansible awx tutorial,ansible awx demo,ansible awx vs tower,ansible playbook gui,ansible awx docker