Read this in other languages:
English, Français.
In this part of the workshop, we will learn how to leverage the use of workflows in Ansible Automation Platform to orchestrate patch management for several linux servers . Automating patch management reduces human error and improves configuration and patch accuracy. Additionally, automation provides capabilities to reduce the manual input associated with identifying, testing and patching systems. Using Automation Platform enables more complicated patching scenarios.
Satellite 6.x, Ansible Automation Platform 4.x
3 x Red Hat Enterprise Linux clients v7.9
Exercise 0 : Lab Setup
Organization to be used = Default Organization
Location to be used = Default Location
A content view = RHEL7
Lifecycle environments = Dev, QA, Prod
Now we will start configuring a workflow that encompasses publishing a content view, promoting a content view, a fact scan, as well as a server patching. The goal is to publish a new content view and promote our rhel7_DEV environment to QA.
Start by clicking “Templates” from the left side pane menu, and then click on the blue “Add” dropdown button and choose “Add workflow template”.
Create the name “SATELLITE / Patching Workflow” and click Save (there are no other options necessary to select on this page).
This should open a blank workflow, offering to start building it by choosing the green Start button. You can always get back to this workflow from the template by selecting the ‘Visualizer’ tab.
This step in the workflow adds your first job template which runs a playbook called ‘satellite_publish.yml’.
At this point your workflow should resemble the following:
There are two more nodes to add to this workflow. Hover the ‘SATELLITE / RHEL - Publish Content View’ node and click the + icon. In the pop-up window, select ‘On Success’ and then Next. Add the ‘SATELLITE / RHEL - Promote Content View’ Job Template, and leave ‘Convergence’ to ‘Any’ again. There is a survey attached that requires variables for content view, current lifecycle environment, and next lifecycle environment. For the purpose of this lab we’re going to promote Dev to QA.
Select RHEL7 for ‘Content View’
Select RHEL7_Dev for ‘Current Lifecycle Environment’
Select RHEL7_QA for ‘Next Lifecycle Environment’
Click ‘Next’. You will then need to ‘Save’ the preview.
Add the last node by hovering over ‘SATELLITE / RHEL- Promote Content View’ and selecting the + icon. In the pop-up window, select ‘On Success’, and then Next. Add the ‘SERVER / RHEL7 - Patch’ Job Template, leave ‘Convergence’ to ‘Any’ again and select Next. This template also has a survey attached. You will need to select from drop-down list ‘Select Environment’ the environment you would like to patch. Choose ‘RHEL7_Dev’. The ‘Check’ drop-down is a selection that tells server_patch.yml whether or not to apply updates to the servers in our inventory. Since we want to apply the patches, we will select ‘No’. Click ‘Next’ at the bottom of the window and click ‘Save’.
Before we can finish the workflow we need to link ‘SERVER / RHEL7 - Fact Scan’ to ‘SERVER / RHEL7 - Patch’ and coverage on success. Hover over ‘SERVER / RHEL7 - Fact Scan’ and click on the chain icon. Then click to the right of the ‘SERVER / RHEL7 - Patch’ node to link. You will be promoted on the right side pane menu to to Run ‘On Success’. Click ‘Save’. You will then need to click on the ‘SERVER / RHEL7 - Patch’, edit the node and select ‘ALL’ from the CONVERGENCE drop-down. Continue with Next, Next and Save.
Your workflow should resemble the following:
You can now save and exit the workflow template.
Click on ‘Content’ then ‘Content Views’ and select RHEL7. Notice the new content view version.
Navigate to Hosts > All Hosts and select node1.example.com. Select the ‘content’ tab under Details. Notice the Installable errata; this is your number of errata before running your patch workflow.
Click on Templates to locate the ‘SATELLITE / Patching Workflow’ template. You can either click on the rocketship to the right of the template or select the template and select LAUNCH. (they do the same thing).
Observe the job kicking off in Ansible. You need to wait for this workflow to complete before moving on to the next step. This workflow should take ~5 mins to complete. Watch the green boxes expanding and contracting in each of the workflow nodes. The node box will go green when the step is complete - you can also hover over a workflow node to see a status.
Click on ‘Content’ then ‘Content Views’ and select RHEL7. Notice the new content view version.
Navigate to Hosts > All Hosts and select node1.example.com. Select the ‘content’ tab under Details. Notice that the Installable errata has decreased. This indicates that we have applied our updates.