It is not at all uncommon for an organization to have a policy of not adding human-friendly names of network devices to DNS, for security reasons. Many humans, of course, prefer to work with names rather than IP addresses. Static local host names map a human friendly host name to a layer 3 address, without using DNS. Managing static local host names on network devices allows network administrators to work with names, without the potential security considerations associated with listing devices in DNS.
Maintaining static local host names is relatively simple with automation, but can be disastrous without it.
This exercise demonstrates how the Survey feature in Red Hat Ansible Tower makes it easy to add a static local host name to all managed network devices.
In this exercise, you will push a host name mapping to all managed network devices.
Outcomes
You should be able to:
Create a Vault credential in Red Hat Ansible Tower.
Create a Project in Red Hat Ansible Tower.
Create a Job Template in Red Hat Ansible Tower.
Create a Survey with the Job Template.
Create Jobs by launching the Job Template.
Review the status of Jobs.
Open Firefox on the workstation VM.
Log in to Ansible Tower at https://tower.lab.example.com as admin using student as the password.
It is assumed that Lab 4 has been completed successfully so that the inventory named lab.example.com exists.
Create a Vault credential named example.com-credential in Red Hat Ansible Tower.
Click the Settings icon (the gear) and select .
Click to display the NEW CREDENTIAL page.
In the NAME field, type example.com-credential.
Specify Vault as the CREDENTIAL TYPE.
In the ORGANIZATION field, click the magnifying glass and select Default.
In the VAULT PASSWORD field, type redhat.
Click to create the Vault credential.
Create a project named add-static-hostname in Red Hat Ansible Tower.
Select in the quick menu at the upper left.
Click to create a new project.
In the NAME field, type add-static-hostname.
Specify Default as the ORGANIZATION.
For SCM TYPE, select
.
In the SCM URL field of the SOURCE DETAILS panel, type http://git.lab.example.com:3000/student/network-static-hostname.git.
In the SCM BRANCH/TAG/COMMIT field, type master.
Within the lab environment, this is considered a public repository, so leave the SCM CREDENTIAL field empty.
Click to create the project.
Create a job template named add-static-hostname in Red Hat Ansible Tower.
Select in the quick menu at the top of the window.
Click and select
to display the NEW JOB TEMPLATE page.
In the NAME field, type add-static-hostname.
Set the JOB TYPE to
.
In the INVENTORY field, type lab.example.com.
That is the inventory you created in Lab 4.
In the PROJECT field, click the magnifying glass and select the add-static-hostname project.
In the PLAYBOOK field, select
.
In the CREDENTIAL field, click the magnifying glass, select
for the CREDENTIAL TYPE, select example.com-credential, and click to complete your selection.
Click to save your work.
Create a survey with the job template.
On the NEW JOB TEMPLATE page for the add-static-hostname job template, click to display the ADD SURVEY PROMPT page.
In the PROMPT field, type “Hostname?”.
In the DESCRIPTION field, type “A human-friendly name”.
In the ANSWER VARIABLE NAME field, type static_local_hostname.
In the ANSWER TYPE field, select
and click to add the survey prompt.
On the ADD SURVEY PROMPT page, type “Address?” in the PROMPT field.
In the DESCRIPTION field, type “An IPv4 host address”.
In the ANSWER VARIABLE NAME field, type static_local_ipv4addr.
In the ANSWER TYPE field, select .
For MINIMUM LENGTH, type the minimum number of characters in an IPv4 address, which is 7.
For MAXIMUM LENGTH, type the maximum number of characters in an IPv4 address, which is 15.
Click to add this survey prompt.
Check your work in the PREVIEW pane at the right side of the window. Click the edit icon (the pencil) to make corrections. When you are satisfied with your work, click .
Create jobs by launching the job template.
At the TEMPLATES / add-static-hostname page, scroll down to the TEMPLATES pane at the bottom of the page.
In the add-static-hostname job template row, click the launch icon (the rocket) to start a job using that template.
On the LAUNCH JOB | add-static-hostname SURVEY page, type “tower” in the HOSTNAME field.
Type 172.25.250.9 in the ADDRESS field, and then click .
Review the status of jobs.
Click in the quick menu at the top of the window.
Locate the most recent add-statichostname job.
Click the magnifying glass in its row to view the job.
This concludes the guided exercise.