Virtual Geek

Tales from real IT system administrators world and non-production environment

Getting started Ansible AWX tower for IT automation run first playbook

In this article I will show how to use and run basic playbook with Ansible AWX tower portal. Ansible Tower is a Red Hat product it helps you to centralize and control your IT infrastructure with a visual dashboard, role-based access control, job scheduling, integrated notifications and graphical inventory management. Easily embed Ansible Tower into existing tools and processes with REST API and CLI. It does the same thing whatever you do with commandline Ansible with better way with less hassle on the tower, and complete history/lifecycle.

AWX is an open source web application that provides a user interface, REST API, and task engine for Ansible. it has got all the features and capable of doing what Ansible Tower does. It's the open source version of the Ansible Tower. The AWX allows you to manage Ansible playbooks, inventories, and schedule jobs to run using the web interface. 

An organization in the tower is a logical collection of Users, Teams, Projects, and Inventories, and is the highest level in the Tower object hierarchy.

Ansible awx tower organizations inventories groups hosts teams credentials permissions users credentisls permissions projects playbooks job templates jobs gui ansible automation yaml yml.png

From the navigation pane click on Organizations and click  +  green Plus button icon, Give it a name for your organization, it will be listed below once you save it, you can also create new users and assign permissions to this org. Throughout the guide I will use same organization for testing purpose.

ansible awx, ansible tower, organizations, port 8052, free ansible tower, devops ansible-playbook, yml yaml configure vmware vsphere.png

Next item is Inventories from navigation pane, An inventory is a collection of hosts against which jobs may be launched, click  +  green Plus button icon, On the details I will give it a name and using earlier created organization, save the Inventory. (You can go ahead and configure GROUPS also once hosts are added)

Ansible tower, ansible awx tower, inventory, inventories hosts, organization insights groups, variables yaml json IT automation save yml ansible playbook anisble-playbook.png

Added inventory is empty, we will need to add hosts/servers list, click on   HOSTS   button on the tab then click  +  green Plus button icon, add hosts IPs or FQDNs or ComputerNames, save it. For testing purpose I an adding only one host, If there are more than one host make sure either you have configured ssh key for authentication or user/passwords are same across the computers.

AWX-RPM ansible awx tower free, ansible tower free redhat, inventory, inventories hosts ping server, ansible-playbook, yaml yml, groups vars.png

Next is crucial step to add credentials from navigation menu, Credentials are utilized by Tower for authentication when launching Jobs against machines, synchronizing with inventory sources, and importing project content from a version control system. You can grant users and teams the ability to use these credentials, without actually exposing the credential to the user. click  +  green Plus button icon.

I am adding credentials for github source control, where all the playbooks are stored, this credential I will use in projects to authenticate git, Select a name for credentials item and organization name used earlier by clicking on the search icon, On the Credential type search for Source Control (used for github or equivalent system), and in the last type username and password, save it.

ansible tower, ansible awx credentials awx-rpm, ansible awx tower, orgnization, credential type, source control username password ansible playbook yaml yml, SCM private key passphrase.png

Add one more credential to connect hosts in the inventory, This time choose credential type as Machine (for linux), you have total two credentials now. (In the machines you can also add generated ssh key instead of username and password).

ansible awx tower redhat ansible free tower license, credentials type machine username password signed ssh certificate private key public key, prompt on launch, orgnization ansible-playbook.png

Project is a logical collection of Ansible playbooks, represented in Tower. Go to Projects in navigation pane, click  +  green Plus button icon, fill up the information, such as Name for project and Organization, next from SCM Type I selected git, as all my scripts are stored and git system, and on the SCM Credential choose earlier created credentials for git with same name and save the project. Once done click on the sync icon, Project status must be green.

How to install Ansible on Linux for vSphere configurationansible awx tower opensource projects soruce details scm url scm credentials inventories scm branch tag commit refspec organization job template sync update option.png

Next is a last step and I will be joining all the pieces together to create a template. Job templates are useful to execute the same job many times. While the REST API allows executing jobs directly, Tower requires first creating a job template. Go to the Templates in the resources from navigation panel, and click  +  green Plus button icon to add a template.

Once all the information is configured save it and press launch button.

ansible awx tower, awx-rpm templates playbook add, job template, resources, free tower, ansible-playbook playbook launch yaml yml.png

Give template a meaning full name JOB TYPE will be default Run, next in the Inventory search earlier created Inventory, and in the Project by clicking search icon select the project created above. Once Project is added successfully, you will see all the playbooks (its from my central git repo, local copy is made locally) and select the yml playbook (all the playbook must have yml or yaml extension also there shouldn't be error, it should be tested before putting on git, tower verifies the repo and only lists valid playbook files where there is no code errors in the files), Next select the credentials to connect inventory hosts. Save and launch it.

ansible awx tower, redhat ansible tower free license, yml yaml, ansible-playbook inventory job type run scm credentials ping test, skip tags templates verbosity extra variables yaml json launch.png

I am using below sample playbook and it is stored on my central git account.

- name: Check connectivity to remote servers
  hosts: all #servergroup01
    - name: ping

Once you click launch on template you will be redirected to Jobs, it will take some time to execute the playbook and show the successful results on the screen.

ansible awx-rpm tower awx tower linux root password credentials ping test ansible-playbook  yaml playbook, yml envornment rh-python36, jobs.png

Useful articles
How to install Docker on Linux
Cannot connect to the Docker daemon at unix:var run docker.sock. Is the docker daemon running
Docker Error response from daemon i\o timeout internet proxy
How to install Ansible on Linux for vSphere configuration
How to Setup Passwordless SSH Login on Windows
configure remote ssh extension on visual studio code
VS code remote ssh could not establish to host, connecting was canceled

Go Back


Blog Search

Page Views


Follow me on Blogarama