In this exercise, we are going to configure Tower so that we can run a playbook.
There are a number of constructs in the Ansible Tower UI that enable multi-tenancy, notifications, scheduling, etc. However, we are only going to focus on a few of the key constructs that are required for this workshop today.
-
Credentials
-
Projects
-
Inventory
-
Job Template
To log in, use the username admin and and the password ansibleWS.
Figure 3: Ansible Tower Login Screen
As soon as you login, you will prompted to request a license or browse for an existing license file
Figure 4: Uploading a License
In a seperate browser tab, browse to https://www.ansible.com/workshop-license to request a workshop license.
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.
There are many types of credentials including machine, network, and various cloud providers. In this workshop, we are using a machine credential.
Complete the form using the following entries
NAME |
Ansible Workshop Credential |
DESCRIPTION |
Credentials for Ansible Workshop |
ORGANIZATION |
Default |
CREDENTIAL TYPE |
Machine |
USERNAME |
Your Workshop Username - Student(x) |
PASSWORD |
Your Workshop Password |
PRIVILEGE ESCALATION METHOD |
Sudo (This is the default) |
Figure 5: Adding a Credential
A Project is a logical collection of Ansible playbooks, represented in Tower. You can manage playbooks and playbook directories by either placing them manually under the Project Base Path on your Tower server, or by placing your playbooks into a source code management (SCM) system supported by Tower, including Git, Subversion, and Mercurial.
Complete the form using the following entries
NAME |
Ansible Workshop Project |
DESCRIPTION |
Workshop playbooks |
ORGANIZATION |
Default |
SCM TYPE |
Git |
SCM URL |
|
SCM BRANCH |
|
SCM UPDATE OPTIONS |
Figure 6: Defining a Project
An inventory is a collection of hosts against which jobs may be launched. Inventories are divided into groups and these groups contain the actual hosts. Groups may be sourced manually, by entering host names into Tower, or from one of Ansible Towers supported cloud providers.
An Inventory can also be imported into Tower using the tower-manage command and this is how we are going to add an inventory for this workshop.
Complete the form using the following entries
NAME |
Ansible Workshop Inventory |
DESCRIPTION |
Ansible Inventory |
ORGANIZATION |
Default |
Figure 7: Create an Inventory
Use the tower-manage command to import an existing inventory. (Be sure to replace <username> with your actual username)
sudo tower-manage inventory_import --source=/home/<username>/lightbulb/lessons/lab_inventory/<username>-instances.txt --inventory-name="Ansible Workshop Inventory"
You should see output similar to the following:
Figure 8: Importing an inventory with tower-manage
Feel free to browse your inventory in Tower. You should now notice that the inventory has been populated with Groups and that each of those groups contain hosts.
Figure 9: Inventory with Groups
Figure 10: web inventory group detail
At this point, we are doing with our basic configuration of Ansible Tower. In the next exercise, we will be solely focused on creating and running a job template so you can see Tower in action.