Add a survey to an existing job template and launch a job using that survey.
Outcomes
Add a survey to an existing job template.
Launch a job using a survey from the automation controller web UI.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command ensures that automation controller is installed and configured with any necessary resources created in previous exercises.
[student@workstation ~]$ lab start job-survey
Procedure 5.2. Instructions
Navigate to https://controller.lab.example.com and log in as the admin user with redhat as the password.
Add a survey to the DEV webservers setup job template.
Navigate to → and then click the link.
Click the tab and then click .
Add a single question to the survey, using the following information. When finished, click .
| Field | Value |
|---|---|
What version are you deploying?
| |
This version number is displayed at the bottom of the index page.
| |
deployment_version
| |
| (selected) | |
1
| |
40
| |
v1.0
|
Click and verify that the label changes to . The survey is now enabled.
The survey is disabled by default. Make sure that you enable it.
Clone the https://git.lab.example.com/git/my_webservers_DEV.git Git repository into the /home/student/git-repos directory.
From a terminal, create the /home/student/git-repos directory if it does not already exist, and then change into it:
[student@workstation ~]$mkdir -p ~/git-repos/[student@workstation ~]$cd ~/git-repos/
Clone the https://git.lab.example.com/git/my_webservers_DEV.git repository and then change into the cloned repository:
[student@workstation git-repos]$git clone \>https://git.lab.example.com/git/my_webservers_DEV.gitCloning into 'my_webservers_DEV'... ...output omitted... [student@workstation git-repos]$cd my_webservers_DEV
Modify the ~/git-repos/my_webservers_DEV/templates/index.html.j2 Jinja2 template to use the variable from the survey.
Edit the index.html.j2 template to add the following line to the bottom of the file:
Deployment Version: {{ deployment_version }} <br>After you edit and save index.html.j2, the file contains the following content:
Current Host: {{ ansible_facts['fqdn'] }} <br>
Server list: <br>
{% for host in groups['all'] %}
{{ host }} <br>
{% endfor %}
Deployment Version: {{ deployment_version }} <br>Add, commit, and push the file to the remote Git repository:
[student@workstation my_webservers_DEV]$git add templates/index.html.j2[student@workstation my_webservers_DEV]$git commit \>-m "Display Deployment Version on index page"[main 2c435c7] Display Deployment Version on index page 1 file changed, 1 insertion(+) [student@workstation my_webservers_DEV]$git push -u originEnumerating objects: 7, done. Counting objects: 100% (7/7), done. Delta compression using up to 4 threads Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 468 bytes | 468.00 KiB/s, done. Total 4 (delta 2), reused 0 (delta 0), pack-reused 0 To https://git.lab.example.com/git/my_webservers_DEV.git 3b3341b..2c435c7 main -> main
Update the local copy of the Git repository on automation controller for the My Webservers DEV project.
Navigate to → .
On the same line as the My Webservers DEV project, click the icon and wait for the column to display .
Click the icon in the column to update the revision version. The revision matches the last commit. You can verify this information with the following command:
[student@workstation my_webservers_DEV]$ git log --pretty=format:'%h' -1
2c435c7As a member of the Developers team, launch a job using the updated DEV webservers setup job template.
Navigate to → in the upper-right corner to log out, and then log back in as daniel using redhat123 as the password.
Navigate to → and then click the icon for the job template. This opens the survey you just created and prompts for your input.
Leave v1.0 in the text field and click followed by to launch the job. This redirects you to a detailed status page of the running job.
Briefly observe the live output of the running job.
When the job is complete, confirm that the of the job in the tab is Successful.
Verify that the web servers have been updated on servera.lab.example.com and serverb.lab.example.com.
Open a web browser and navigate to http://servera.lab.example.com and http://serverb.lab.example.com in separate tabs. You should see this line at the bottom of both pages:
...output omitted...
Deployment Version: v1.0If you complete the exercises in this course out of order, or if you repeat this exercise after completing later exercises, then your web browser might redirect requests to the HTTPS versions of http://servera.lab.example.com and http://server.lab.example.com. The redirection results in Unable to connect messages because the DEV webservers setup job template does not configure HTTPS.
If this happens, then you can either clear your web browser cache or you can use the curl command to verify the content of the web servers.
Navigate to → in the upper-right corner to log out of the automation controller web UI.