Bookmark this page

Integrating Red Hat Insights and Automation Controller

Objectives

  • Remediate issues that are reported by Red Hat Insights by using automation controller from Red Hat Ansible Automation Platform.

Automate Red Hat Insights with Automation Controller

Integrating automation controller with Red Hat Insights enables you to automate Insights remediation for a group of registered systems. In automation controller, you can create a Source Control Manager (SCM) project that uses Insights as the SCM for the project's Ansible Playbooks. You must create a credential in automation controller of the Insights type to store the username and password for your Red Hat Insights account, and then configure your project to use that credential for authentication.

One of the advantages of this configuration is that users can run maintenance plan Ansible Playbooks from automation controller without having direct access to the credentials for the Red Hat Insights account. The credentials are stored in automation controller, and you can use automation controller's permissions system to protect them from being read directly.

Create Credentials for Insights in Automation Controller

The Insights credential stores the username and password that are used to log in to the Red Hat Insights interface in the Customer Portal. The Insights project in automation controller uses the Insights credential to download the Ansible Playbooks that are created by using the Insights planner, and to list the Insights actions that are associated with a registered system.

In the automation controller web UI, use the following steps to create an Insights credential:

  • Navigate to ResourcesCredentials and click Add.

  • Specify a name for the credential and optionally enter a description.

  • Select Insights from the Credential Type list.

  • Use a valid Red Hat Customer Portal account username and password for the Type Details credentials.

  • Click Save.

Figure 10.26: Create an Insights credential

Create an Insights Project in Automation Controller

Automation controller projects support a special SCM repository type specifically for Red Hat Insights. Upon selecting the Insights source control, the project retrieves its Ansible Playbooks directly from the maintenance plans that you created in Insights.

In the automation controller web UI, use the following steps to create an Insights project:

  • Navigate to ResourcesProjects and click Add.

  • Specify a name for the project and optionally enter a description.

  • Select Red Hat Insights from the Source Control Type list.

  • In the Insights Credential search field, select the Insights credential that you previously created.

  • Click Save.

Figure 10.27: Create an Insights project

Create an Inventory for Insights in Automation Controller

The Ansible Playbooks that are created by Insights specify hosts by name for each play. The hostnames in the inventory that is used by automation controller must match the names that are used for registered systems in the Red Hat Insights Customer Portal. You can manually add the hosts in the inventory, or retrieve them as dynamic inventory from Insights.

In the automation controller web UI, use the following steps to create an inventory:

  • Navigate to ResourcesInventories.

  • Click Add, and select the Add inventory type.

  • Specify a name for the inventory.

  • Click Save.

Figure 10.28: Create an inventory

After creating the inventory, use the following steps to add the host manually:

  • Click the Hosts tab.

  • Click Add.

  • Specify the name for the host.

  • Click Save.

Alternatively, you can create an Insights inventory source to dynamically generate a list of hosts that are registered in Insights. After creating the inventory, use the following steps to add the host dynamically:

  • Click the Sources tab.

  • Click Add.

  • Specify the name for the inventory source.

  • Select Red Hat Insights from the Source list.

  • For the Credential field under Source details, use the Red Hat Insights credential that you previously created.

  • Click Save.

Figure 10.29: Create an inventory source

Create a Job Template in Automation Controller

To enable automation controller to use the Ansible Playbooks from Insights maintenance plans in a job template, the playbooks must be imported from your Insights account into your project in automation controller.

In the automation controller web UI, use the following steps to create a job template:

  • Navigate to ResourcesTemplates.

  • Click Add, and select Add job template from the list.

  • Specify the name for the job template.

  • In the Job Type list, select Run to execute the job template when it launches.

  • In the Inventory search field, select the My Insights Inventory inventory.

  • In the Project field, select the My Insights Project project.

  • In the Playbook list, select the Ansible Playbook that is associated with the maintenance plan that you want to run.

  • In the Credentials search field, select the credentials to authenticate the automation controller.

  • Click Save.

Figure 10.30: Create a job template

To run the job template, click Launch to run the Ansible Playbook.

Alternatively, you can run the job template by navigating to ResourcesTemplates, and then clicking the launch icon (the rocket icon).

Figure 10.31: Job template result

Automation controller shows the result of the playbook execution. To find the results of the executed jobs, navigate to Jobs from the navigation bar.

References

For more information about Red Hat Insights remediations, refer to the Settting up Insights Remediations section of the Automation Controller User Guide at https://docs.ansible.com/automation-controller/latest/html/userguide/insights.html

Revision: rh415-9.2-a821299