Remediate an issue that is reported by Red Hat Insights by using an Ansible Playbook provided by Insights and automation controller.
Outcomes
Register a host by using the insights-client command.
Configure Insights and create an Ansible job template.
Remediate the host by running the Ansible job template.
As the student user on the workstation machine, use the lab command to prepare your environment for this exercise, and to ensure that all required resources are available.
[student@workstation ~]$ lab start insights-integrating
Instructions
From the workstation machine, log in to the serverd machine as the student user, and switch to the root user.
Log in to the serverd machine as the student user.
[student@workstation ~]$ ssh student@serverd
[student@serverd ~]$Change to the root user.
Use student as the password.
[student@serverd ~]$sudo -i[sudo] password for student:student[root@serverd ~]#
Check the serverd machine registration status with Red Hat Customer Portal and Red Hat Insights.
Check the serverd machine registration status with Red Hat Customer Portal.
If the machine is not registered, then register it by using the subscription-manager register command.
Use a valid Red Hat Customer Portal account.
[root@serverd ~]# subscription-manager status
+-------------------------------------------+
System Status Details
+-------------------------------------------+
Overall Status: Disabled
Content Access Mode is set to Simple Content Access. This host has access to content, regardless of subscription status.
System Purpose Status: DisabledThe preceding output indicates that the client is registered using Simple Content Access for its content access mode, even though the overall subscription status is Disabled.
Because the client is using Simple Content Access, it does not need to have specific product entitlements enabled.
Check the serverd machine registration status with Red Hat Insights.
If the machine is not registered, then register it by using the insights-client --register command.
Use a valid Red Hat Customer Portal account.
[root@serverd ~]# insights-client --status
System is registered locally via .registered file. Registered at 2023-12-19T11:17:23.005881
Insights API confirms registration.Create a playbook to remediate a CVE vulnerability.
Log in to the Red Hat Insights web UI at https://console.redhat.com/insights/. Use the same Red Hat Customer Portal account that you used in Step 2.
Navigate to → .
Click .
Click the tab.
Select the checkbox for the CVE-2023-3972 CVE identifier, and click .
In the dialog, enter CVE remediation playbook in the field, and click .
If it is not already selected, then select the serverd.lab.example.com value and click .
Review the remediation. If Insights requests a reboot, then you can disable it by clicking .
Click to create the playbook.
Log in to the automation controller web UI at https://controller.lab.example.com.
Use admin as the user and redhat as the password.
Create a Machine credential type named Classroom servers credential.
Navigate to → and click .
Enter Classroom servers credential in the field.
In the search field, enter the Default organization.
Select Machine from the list.
Enter student in the field.
Enter student in the field.
Select sudo from the list.
Enter root in the field.
Enter student in the field.
Leave the other fields untouched and click .
Create an Insights credential type named RH account credential.
Use the same Red Hat Customer Portal account that you used in Step 2.
Navigate to → and click .
Enter RH account credential in the field.
In the search field, enter the Default organization.
Select Insights from the list.
Enter a valid Red Hat Customer Portal account username and password for the credentials.
Click .
Create a Red Hat Insights project type named Insights project.
Navigate to → and click .
Enter Insights project in the field.
Select Red Hat Insights from the list.
Under , enter the RH account credential value in the search field.
Leave the other fields untouched and click .
Create the My servers inventory standard inventory.
Add the serverd.lab.example.com host.
Navigate to → .
Click , and select the Add inventory type.
Enter My servers inventory in the field.
Leave the other fields untouched and click .
Under the My servers inventory details, select the tab, and click .
Enter serverd.lab.example.com in the field
Leave the other fields untouched and click .
Create a job template named Fix Insights servers.
Navigate to → .
Click , and select Add job template from the list.
Enter Fix Insights servers in the field.
Select Run from the list.
Enter My servers inventory in the search field.
Enter Insights project in the field.
Select the Ansible Playbook that is associated with the maintenance plan that you want to run from the list.
Enter Classroom servers credential in the search field.
Leave the other fields untouched and click .
Launch the Fix Insights servers job template, and verify the result.
Navigate to → .
Click the icon for the Fix Insights servers job template and wait for the job to complete.
Verify the results of the job.
...output omitted...
PLAY RECAP *********************************************************************
serverd.lab.example.com : ok=3 changed=1 unreachable=0 failed=0 skipped=4 rescued=0 ignored=0Verify that the CVE-2023-3972 CVE identifier is no longer reported in the Red Hat Insights web UI for the serverd.lab.example.com system.
Log in to the Red Hat Insights web UI at https://console.redhat.com/insights/. Use the same Red Hat Customer Portal account that you used in Step 2.
Navigate to → .
Click .
Click the tab.
Enter the CVE-2023-3972 CVE identifier in the search field.
Confirm that the CVE is no longer reported for the serverd.lab.example.com system.