On previous chapter we configured Azure AD authentication and created hello-world project. Now we can try to do something more practical, for example, we could try to install NGINX package on a test environment.
The Ansible structure is agentless (it connects using SSH), and configurations are set up as playbooks written in YAML.
With the Tower we can manage playbooks and playbook directories by either placing them manually under the Project Base Path on the server, or by placing playbooks into a source code management (SCM) system supported by Tower, including Git, Subversion, Mercurial, and Red Hat Insights.
In our scenario we will use configuration, which contains following parts:
- Source Code Management system - we will use our demo Github repository
- AWX Host
- Test Azure VM - in our case we can create another virtual machine in Azure. To do that we can create a free account virtual machine (available for a MSDN Azure subscription) or create a standard Ubuntu VM:
Also we need to configure NSG for a newly created VM - enable SSH access from AWX host IP address and open 80 port:
On AWX side we need to configure and run job template. To do that, please, complete following steps:
- Create an inventory
- Add a host to the inventory
- Create a credentials
- Setup a project
- Create a job template
- Launch the template
Inventory - a collection of hosts against which Jobs may be launched. Let's use understandable title:
Now we can add Public IP address of our test VM to the hosts:
Credentials in our case - are username and password values used to create test node:
A Project is a logical collection of Ansible playbooks, represented in Tower. In this article we are using following Github repository:
A job template is a definition and set of parameters for running an Ansible job. In the example below, we are applying "nginx-hello-world/main.yml" playbook to the "Azure Inventory" using "Azure Credentials" to access the test node:
After project configuration we can run it:
If template run job was successfull - we can try to access test node by HTTP: