Creating Insights Maintenance Plans with Ansible Playbook Integration
The Guide to Generating Ansible Playbooks to Implement Insights Maintenance Plans
Chapter 1. Getting Started
Red Hat Insights has the ability to integrate Ansible Playbooks into Insights maintenance plans. This document will help Red Hat Insights users to create maintenance plans and playbooks using the Insights UI in the Red Hat Customer Portal. Ansible Playbook integration with Insights can help system administrators save time, be more productive, eliminate repetitive tasks, and reduce or eliminate errors.
The following limitations or restrictions apply to Ansible integration with Red Hat Insights:
- Currently, Ansible Playbook capability is available exclusively through the Customer Portal and, as such, is unavailable via Satellite and CloudForms integrations. Satellite users can use it via the Customer Portal UI.
- If you change a system’s hostname when registering that system in Insights, the same name must be used in the Ansible inventory or the generated playbook will not run.
- There may not be a playbook for every rule. We’re currently expanding our offering; however, only those rules showing an Ansible icon have a playbook currently available.
These instructions assume that system administrators have met the following prerequisites:
Chapter 2. Creating a Plan
2.1. Creating an Insights Maintenance Plan
From within the Insights UI, there are multiple paths to create a maintenance plan with playbook integration. Included below are routes by way of the Inventory tab (a systems-centric approach) and through the Actions tab (a rule-centric approach).
2.1.1. Create a Maintenance Plan from the UI Inventory Tab
From the Insights UI, you can select the system or systems for which to resolve vulnerabilities, then drill down into the rules affecting those systems.
- Navigate to the Inventory tab of the Insights UI in the Customer Portal.
Select the systems you want to include in your maintenance plan.
View all of your systems by default, or filter the visible systems using the Group, System Status, or System Health dropdown menus.
- Click the Actions dropdown list located above the systems list and select Create a New Plan/Playbook or Add to Existing Plan/Playbook.
- In the dialog box, enter a plan name if creating a new plan, or if adding systems to an existing plan, select that plan from the dropdown menu.
Select the vulnerabilities you want this maintenance plan to resolve by clicking the checkboxes next to each action and click Save.
The plan is now visible at the bottom of the list of plans in the Planner view. Note the plan number.
Carefully review each vulnerability and the systems affected.
For each vulnerability, you can add or remove systems by clicking Edit.
- Click Download Playbook.
2.1.2. Create a Maintenance Plan from the UI Actions Tab
From the Insights UI, you can select individual rules or from rule types—Availability, Stability, Performance, and Security—and repair systems affected by those rules.
- Navigate to the Actions tab of the Insights UI in the Customer Portal.
Select a category for the type of issues you want to address.
Scroll down to view the rules within this category that affect your systems.
- Click on the rule you want to address.
- Following the rule description, scroll down to view the systems affected by this rule.
- Select all systems or individual systems that you want to repair.
- Click the Actions dropdown menu above the listed systems and choose whether to Create a new Plan/Playbook or Add to an existing Plan/Playbook.
- In the dialog box, enter a plan name if creating a new plan or, if adding systems to an existing plan, select that plan from the dropdown menu.
Below the plan name, in the Actions tab (shown by default), you can add more rules/actions that affect the selected systems. Or you can click the Systems tab and add more systems affected by the rule.
- Click Download Playbook.
Chapter 3. Running a Playbook
3.1. Running Ansible Playbooks in Insights
After you create a maintenance plan in the Insights UI, run the plan as a playbook from the command line.
As of the current release, playbooks are available for most—but not all—rule vulnerabilities. Maintenance plans that include rules for which there is no playbook will show the Download Playbook button grayed out. For playbook integration, look for the blue Ansible icon next to the rule.
3.1.1. Generate an Ansible Playbook from the Insights UI
Ansible Playbooks are generated at the time the maintenance plan is created, or can be generated later, from the maintenance plan list in the Planner tab of the Insights UI.
- Navigate to the Planner tab of the Insights UI in the Customer Portal.
- Select a plan.
- Click Download Playbook, located in the bottom right corner of the plan card.
- Save the .yml file in an appropriate directory.
3.1.2. Run an Ansible Playbook
To run an Ansible Playbook, open a terminal and execute
# ansible-playbook <playbook>.yml
188.8.131.52. View Results in Planner
After you run the playbook, go to the the UI Planner and view the issues that have been remediated.
Revised on 2018-09-24 19:10:13 UTC