Create a survey to provide values for variables that are used by the Ansible Playbook run by the job template, such as the device hostname and DNS settings.
Outcomes
Create an automation controller job template.
Add a survey to an existing job template.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise, and to ensure that all required resources are available.
This command also creates two Git repositories and the following automation controller resources:
The Cisco IOS XE Auth machine credential
The Inventories project
The Common inventory
The Surveys project
The Check Cisco DNS job template
[student@workstation ~]$ lab start manage-surveys
Instructions
Check the existing hostname and DNS settings for the Cisco IOS managed nodes.
Navigate to https://controller.lab.example.com and log in as admin using redhat as the password.
Click the main menu icon at the top left of the page. Navigate to → and click the icon for the job template.
The job displays the following output:
...output omitted... TASK [Display hostname] ********************************************************* ok: [iosxe1.lab.example.com] => { "ansible_facts['net_hostname']": "iosxe1.lab.example.com" } ok: [iosxe2.lab.example.com] => { "ansible_facts['net_hostname']": "iosxe2.lab.example.com" } TASK [Display DNS lookup status] ************************************************ ok: [iosxe1.lab.example.com] => { "lookup_enabled_msg | trim": "DNS lookup enabled" } ok: [iosxe2.lab.example.com] => { "lookup_enabled_msg | trim": "DNS lookup enabled" } TASK [Display DNS name servers] ************************************************* ok: [iosxe2.lab.example.com] => { "ansible_facts['net_config'] | regex_findall('^ip name-server .*$', multiline=true) | first": "ip name-server 172.25.250.220" } ok: [iosxe1.lab.example.com] => { "ansible_facts['net_config'] | regex_findall('^ip name-server .*$', multiline=true) | first": "ip name-server 172.25.250.220" } TASK [Display DNS domain search] ************************************************ ok: [iosxe1.lab.example.com] => { "ansible_facts['net_config'] | regex_findall('^ip domain list .*$', multiline=true)": [ "ip domain list lab.example.com" ] } ok: [iosxe2.lab.example.com] => { "ansible_facts['net_config'] | regex_findall('^ip domain list .*$', multiline=true)": [ "ip domain list lab.example.com" ] } ...output omitted...
Create the Configure Cisco DNS job template.
Navigate to → and click → . Create the job template with the following settings, and then click :
| Field | Value |
|---|---|
Configure Cisco DNS
| |
Common
| |
Surveys
| |
cisco_configuration.yml
| |
Cisco IOS XE Auth
|
Add four survey questions to the Configure Cisco DNS job template.
Navigate to → and then click the link. Click the tab.
Use the following tables for the survey questions. For each survey question, click to begin creating the question and then click when you finish.
Table 4.2. Survey Question 1
| Field | Value |
|---|---|
Default domain name
| |
This domain is used to set the hostname of the node.
| |
global_domain_name
| |
Text
| |
| (selected) | |
1
| |
251
| |
lab.example.com
|
This exercise does not change DNS records.
When you launch the Configure Cisco DNS job template, entering a value other than lab.example.com for the global_domain_name variable does set a new hostname, but you cannot reach the managed node by the new hostname.
Table 4.3. Survey Question 2
| Field | Value |
|---|---|
Enable DNS lookups?
| |
ios_dns_lookup_enabled
| |
Multiple Choice (single select)
| |
| (selected) | |
true
(selected as default)
| |
false
(not selected as default)
|
Table 4.4. Survey Question 3
| Field | Value |
|---|---|
Select DNS servers
| |
ios_name_servers
| |
Multiple Choice (multiple select)
| |
| (selected) | |
172.25.250.220
(selected as default)
| |
1.1.1.1
(not selected as default)
| |
8.8.8.8
(not selected as default)
|
Table 4.5. Survey Question 4
| Field | Value |
|---|---|
Select domain search paths
| |
ios_domain_search
| |
Multiple Choice (multiple select)
| |
| (selected) | |
lab.example.com
(selected as default)
| |
example.com
(not selected as default)
| |
redhat.com
(not selected as default)
| |
ansible.com
(not selected as default)
|
Enable the survey for the Configure Cisco DNS job template.
Navigate to → and click the link. Click the tab.
Click and verify that the label changes to .
![]() |
Launch the Configure Cisco DNS job template.
Navigate to → and click the icon for the job template. The automation controller web UI opens a dialog box with the job template survey.
Select 1.1.1.1 as an additional entry from the list.
Select example.com as an additional entry from the list.
Click to preview the settings for the job template.
Click to launch the job template and use the variables defined by the survey.
The Configure Cisco DNS job displays a status of .
Verify the changes made by the Configure Cisco DNS job template.
Navigate to → and click the icon for the job template.
The job output displays the updated DNS name servers and domain search entries:
...output omitted... TASK [Display DNS name servers] ************************************************* ok: [iosxe1.lab.example.com] => { "ansible_facts['net_config'] | regex_findall('^ip name-server .*$', multiline=true) | first": "ip name-server 172.25.250.220 1.1.1.1" } ok: [iosxe2.lab.example.com] => { "ansible_facts['net_config'] | regex_findall('^ip name-server .*$', multiline=true) | first": "ip name-server 172.25.250.220 1.1.1.1" } TASK [Display DNS domain search] ************************************************ ok: [iosxe2.lab.example.com] => { "ansible_facts['net_config'] | regex_findall('^ip domain list .*$', multiline=true)": [ "ip domain list lab.example.com", "ip domain list example.com" ] } ok: [iosxe1.lab.example.com] => { "ansible_facts['net_config'] | regex_findall('^ip domain list .*$', multiline=true)": [ "ip domain list lab.example.com", "ip domain list example.com" ] } ...output omitted...