Create a workflow job template that uses a survey and sends email notifications.
Outcomes
Add a survey to an existing job template.
Create a notification template using the Email notification type.
Create a workflow job template and associate it to the notification template.
Launch and approve the workflow job template.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command prepares your environment and ensures that all required resources are available.
[student@workstation ~]$ lab start compreview-workflow
Specifications
In this activity, you create a workflow job template on your automation controller. You can log in to your automation controller at https://controller.lab.example.com as the admin user with redhat as the password.
The lab start compreview-workflow command creates two job templates, MOTD Update and Network Performance Improvements. The Network Performance Improvements job template sets some sysctl kernel tunables (net.core.netdev_max_backlog and net.core.netdev_budget) for the hosts on which it runs. The MOTD Update job template updates the message of the day file (/etc/motd).
The lab start compreview-workflow command also creates two inventories: Dev for development machines (servera.lab.example.com and serverb.lab.example.com) and Prod for production machines (servere.lab.example.com and serverf.lab.example.com).
Configure a new workflow job template, named Improving Network Performance from Dev to Prod, based on the following specification:
Add a survey to the MOTD Update job template using the following information. When done, enable the survey.
| Field | Value |
|---|---|
What is the performance status for this system?
| |
performance_message
| |
| (selected) | |
|
|
Create a notification template using the following information.
| Field | Value |
|---|---|
Email AAP Admins
| |
Sends an email to notify the status of the job
| |
localhost
| |
aap-admins@lab.example.com
| |
system@controller.lab.example.com
| |
25
| |
30
|
Create a workflow job template named Improving Network Performance from Dev to Prod in the Default organization. Structure it as shown in the following diagram.
Set up the first node in the workflow job template to deploy performance improvements to development nodes, based on the following information.
The On failure MOTD (D) node runs if the first node (Performance Improve (D)) fails. Configure it based on the information in the following table.
If the first node (Performance Improve (D)) succeeds, then the workflow launches two nodes that are configured based on the following information.
If the approval node succeeds, then deploy performance improvements to production nodes based on the following information:
If the Performance Improve (P) node succeeds, then launch the MOTD Update job template for production nodes based on the following information:
Configure your Improving Network Performance from Dev to Prod workflow job template with success and failure notifications using the Email AAP Admins notification template previously discussed in this specification. Do not enable notifications for the or options.
To confirm that your workflow job template is correctly configured:
Launch the Improving Network Performance from Dev to Prod workflow job template and approve it when required.
Verify that the completion of the workflow job template triggers an email notification. The student user can access these emails by using ssh to log in to utility.lab.example.com and inspecting the file /var/mail/student, or by installing and using the mutt command to read the mail messages. The password for the student user is student.
Verify that the managed hosts listed in the Dev and Prod inventories display an updated MOTD on login, and that the net.core.netdev_max_backlog and net.core.netdev_budget kernel tunables were modified.
If everything worked, the MOTD should be updated to System has been customized to improve network performance., the net.core.netdev_max_backlog kernel parameter should have a value of 600, and the net.core.netdev_budget kernel parameter should have a value of 10000.
Navigate to https://controller.lab.example.com and log in as the admin user with redhat as the password. Verify that the lab start compreview-workflow command created the MOTD Update and Network Performance Improvements job templates, as well as the Dev and Prod inventories.
Navigate to https://controller.lab.example.com and log in as the admin user with redhat as the password.
Navigate to → , then verify that and are in the list of job templates.
Navigate to → , then verify that and are in the list of inventories.
Add a survey to the MOTD Update job template using the following information. When done, enable the survey.
| Field | Value |
|---|---|
What is the performance status for this system?
| |
performance_message
| |
| (selected) | |
|
|
Navigate to → in automation controller.
Click the link.
Click the tab.
Click to add a survey.
Add a question to the survey using the information from the table. When finished, click .
Click and verify that the label changes to .
Create a notification template using the following information. When finished, click . Then, send a test notification to validate that it is working.
| Field | Value |
|---|---|
Email AAP Admins
| |
Sends an email to notify the status of the job
| |
localhost
| |
aap-admins@lab.example.com
| |
system@controller.lab.example.com
| |
25
| |
30
|
Navigate to → .
Click to create a notification template.
Use the information from the table to create the notification template. When finished, click .
Click to test the notification process. Then, click the tab. After some seconds, the column displays the message.
Create a workflow job template named Improving Network Performance from Dev to Prod in the Default organization. Then, create the first node in the workflow job template using the following information.
| Field | Value |
|---|---|
Performance Improve (D)
| |
Navigate to → .
Click → .
Fill in the details using the following information, and then click .
| Field | Value |
|---|---|
Improving Network Performance from Dev to Prod
| |
Click to add the first workflow job template node using the workflow visualizer.
In the list, choose and select the job template.
Scroll to the bottom of the page and enter Performance Improve (D) in the field. Click when done.
Select the inventory. Click when done.
Click to save the node. Save information about the node, but do not save the workflow job template yet.
If the Performance Improve (D) node fails, then the workflow job template must launch a job template that updates the MOTD in the development environment hosts. Use the information in the table to create the node. Leave the default answer for the survey, indicating that the system has not been customized to improve the network performance. Save information about the node, but do not save the workflow job template yet.
| Field | Value |
|---|---|
On failure MOTD (D)
| |
Without leaving the workflow visualizer, hover over the node and click .
Select and click .
In the list, choose and select the job template.
Scroll to the bottom of the page and enter On failure MOTD (D) in the field. Click when done.
Select the inventory and click .
Leave the default answer for the survey untouched and click .
Click to save the node. Save information about the node, but do not save the workflow job template yet.
If the Performance Improve (D) node succeeds, then the workflow must launch two nodes. Use the information in the following table to create the first of the two nodes. Make sure that you add this node subsequent to the Performance Improve (D) node. Save information about the node, but do not save the workflow job template yet.
| Field | Value |
|---|---|
On success MOTD (D)
| |
Without leaving the workflow visualizer, hover over the node and click .
This time, select and click .
In the list, choose and select the job template.
Scroll to the bottom of the page and enter On success MOTD (D) in the field. Click when done.
Select the inventory and click .
On the survey page, select the answer, and then click .
Click to save the node, but do not save the workflow job template yet.
Use the information in the following table to add a new node to the workflow. Make sure that you add it subsequent to the Performance Improve (D) node. Save information about the node, but do not save the workflow job template yet.
| Field | Value |
|---|---|
Approval
| |
Pushing to Prod requires approval
| |
(min) |
60
|
Without leaving the workflow visualizer, hover over the node and click .
Select and click .
Choose in the list.
Enter Approval in the field.
Enter Pushing to Prod requires approval in the description of the node.
Modify the field to 60 minutes.
Click to save the node, but do not save the workflow job template yet.
If the Approval node succeeds, the workflow job template must launch a job template that improves the network performance in your production environment. Create the node using the following information. Save information about the node, but do not save the workflow job template yet.
| Field | Value |
|---|---|
Performance Improve (P)
| |
Without leaving the workflow visualizer, hover over the node and click .
Select and click .
In the list, choose and elect the job template.
Scroll to the bottom of the page and enter Performance Improve (P) in the field. Click .
Select the inventory. Click .
Click to save the workflow job template node. Save information about the node, but do not save the workflow job template yet.
If the Performance Improve (P) node succeeds, the workflow job template must launch a job template that updates the MOTD in the production environment hosts. This is the final node in the workflow job template. Use the following information to create the node. Then, save the node and save the workflow job template.
| Field | Value |
|---|---|
On success MOTD (P)
| |
Without leaving the workflow visualizer, hover over the node and click .
Select and click .
In the list, choose and select the job template.
Scroll to the bottom of the page and enter On success MOTD (P) in the field. Click when done.
Select the inventory and click .
On the survey page, select ,and then click .
Click to save the node, and then click to save the workflow job template.
Configure the Improving Network Performance from Dev to Prod workflow job template to use the Email AAP Admins notification template. Activate the and notifications. Leave the and options untouched.
Navigate to → .
Click the link.
Click the tab.
Set the and switches to on for the notification. Leave the and options untouched.
Test your work by launching the Improving Network Performance from Dev to Prod workflow job template and approving it when the approval node runs.
Navigate to → .
Click the icon for the Improving Network Performance from Dev to Prod workflow job template.
Observe that the workflow stops at the approval node. Click the notification icon that appears at the top of the page when the workflow stops at the approval node.
Select the checkbox for the in the workflow job template.
Click to approve the execution of the remaining workflow job template nodes.
Navigate to → and wait for the column to display in the job for the workflow job template.
Verify that the Email AAP Admins notification template sent email to the aap-admins@lab.example.com email alias to report the success of the completed job. The student user can access these emails on the utility server.
Open a terminal and connect to the utility server.
[student@workstation ~]$ ssh student@utilityUse the tail command to see the email that was sent by automation controller to report the success of the completed job. Your message looks similar to the following:
[student@utility ~]$tail /var/mail/student"name": "Improving Network Performance from Dev to Prod", "url": "https://controller.lab.example.com/#/jobs/workflow/9", "created_by": "admin", "started": "2022-07-28T23:34:10.961830+00:00", "finished": "2022-07-28T23:34:50.959933+00:00", "status": "successful", "traceback": "", "body": "Workflow job summary:\n\n- node #7 spawns no job.\n- node #9 spawns job #10, \"Network Performance Improvements\", which finished with status successful.\n- node #8 spawns job #11, \"MOTD Update\", which finished with status successful.\n- node #12 spawns job #12, \"Approval\", which finished with status successful.\n- node #11 spawns job #13, \"Network Performance Improvements\", which finished with status successful.\n- node #10 spawns job #14, \"MOTD Update\", which finished with status successful." } [student@utility ~]$
Exit the terminal session on the utility system.
[student@workstation ~]$ exitConfirm that after running your workflow job template, the MOTD and the net.core.netdev_max_backlog and net.core.netdev_budget kernel tunables are modified on the managed hosts in the Dev and Prod inventories.
Now, the net.core.netdev_max_backlog kernel parameter should have a value of 10000 and the net.core.netdev_budget kernel parameter should now have a value of 600.
From a terminal window, connect to servera.lab.example.com. Confirm that the message of the day is System has been customized to improve network performance.
[student@workstation ~]$ssh student@servera.lab.example.com...output omitted..System has been customized to improve network performance....output omitted... [student@servera ~]$
Use the sudo command to change to the root user, using student as the password. Then, verify the values for the net.core.netdev_max_backlog and net.core.netdev_budget kernel tunables.
[student@servera ~]$sudo -i[sudo] password for student:student[root@servera ~]#sysctl net.core.netdev_max_backlog net.core.netdev_budgetnet.core.netdev_max_backlog =10000net.core.netdev_budget =600[root@servera ~]#
Log out of the servera machine.
[root@servera ~]#exitlogout [student@servera ~]$exitlogout Connection to servera.lab.example.com closed. [student@workstation ~]$
Connect to serverf.lab.example.com and observe the message of the day, if any.
[student@workstation ~]$ssh student@serverf.lab.example.com...output omitted..System has been customized to improve network performance....output omitted... [student@serverf ~]$
Use the sudo command to change to the root user, using student as the password. Then, verify the value for the net.core.netdev_max_backlog and net.core.netdev_budget kernel tunables.
[student@serverf ~]$sudo -i[sudo] password for student:student[root@serverf ~]#sysctl net.core.netdev_max_backlog net.core.netdev_budgetnet.core.netdev_max_backlog =10000net.core.netdev_budget =600[root@serverf ~]#
Log out of the serverf machine.
[root@serverf ~]#exitlogout [student@serverf ~]$exitlogout Connection to serverf.lab.example.com closed. [student@workstation ~]$