Easy Integration Using Ansible Tower and Red Hat Insights

May 16, 2018 by Bianca Henderson

Welcome to another entry in the Getting Started Series! In our previous post, we covered how to get started with Ansible and Windows.

In this post we’re going to discuss how you can launch automatically generated playbooks to correct compliance, security and patching issues found in your inventory by Red Hat Insights. To start off, let’s do a brief overview of the magic sauce that is Insights. 

What is Insights?

Red Hat Insights is a predictive IT risk analytics tool that helps enable users to proactively identify, prioritize, and resolve vulnerabilities in their environments before business operations are affected. It does this by evaluating select files on a system, getting smarter and better at predicting outcomes with each piece of information it takes in.

Insights conducts an in-depth analysis of customers’ IT infrastructure and compares this information against Red Hat’s constantly expanding knowledge base to identify key risks and vulnerabilities. If a susceptibility or risk is found, Insights has the ability to generate a playbook for most critical problems detected, which can then be used in Ansible Tower to resolve any issues.

Ansible and Insights?

So if Insights makes Ansible Playbooks...how do you use them in Ansible Tower? Simple. You just plug it in through a project and a template!

This integration feature between Insights and Ansible Tower works because Ansible Tower treats Insights like a Source Control Manager (SCM) where Ansible playbooks are stored. In order to use these playbooks with Ansible Tower, all you need to do is create a Project with your Insights instance.

So… How Do You Actually Do It?

Insights has built some playbooks for you to use, and now you want to use Ansible Tower to deploy those playbooks to make the necessary changes quickly. But how do you do that?

First, we need to configure the Insights credentials inside of Ansible Tower. These are the credentials you use to log into the Insights portal account. The screenshot shows the selection of the correct credential type:

Ansible-Tower-Insights-Integration-6

Next, we need a project to log in to the Insights account using the credentials that were created in the previous step. Once those things are done, the project automatically syncs with the portal. You can also sync it manually at any time by clicking on the button. 

Now we need to put together an inventory created from all of the machines in our Insights portal. The screenshot below shows the Insights inventory “SKO Demo Inventory”:

Ansible-Tower-Insights-Integration-2

Now we can generate a Scan Project, which we’ll do by using a playbook, since once we create a Template with that playbook, we’ll be able to execute it. In order to do this, we’ll input our previously created Inventory and Project in the Template section:

Ansible-Tower-Insights-Integration-9

The screenshot below shows what it looks like when you input the previously created project (in this case the “SKO Demo Scan Project”) into the Add Template screen:

Ansible-Tower-Insights-Integration-1

Here we’ll add the playbook given to us via GitHub:

Ansible-Tower-Insights-Integration-5

We’ll also add the machine credentials (in this case SSH) for logging into the machines:

Ansible-Tower-Insights-Integration-3

After all of that is filled out, you just need to execute the Job Template by clicking on the launch icon:

Ansible-Tower-Insights-Integration-12

On a successful run, an output like this will show up:

Ansible-Tower-Insights-Integration-10

Now if you go into the Inventory screen and look at the specific machines that you ran the playbooks against:

Ansible-Tower-Insights-Integration-7

...you’ll be able to click on the Insights button to bring up risk/vulnerability information for that particular host:

Ansible-Tower-Insights-Integration-8

From that screen you can even click on “View Data in Insights” to see the information in the Insights customer portal, so you can select whichever format you are most comfortable with.

Ansible-Tower-Insights-Integration-4

 

How to Fix Issues

If problems were found, how do you resolve them? Easy! Just go into your Insights Customer Portal, navigate to the Planner tab and select the “Create a plan” option:

Ansible-Tower-Insights-Integration-14

Make sure you name your new plan, then select the issues and systems to fix within it. You’ll be able to see the different problems and risk levels at-a-glance; Insights gives you a variety of solutions for a given issue, so you’ll need to choose the ones that suit your needs best:

Ansible-Tower-Insights-Integration-16

Now go back into your Ansible Tower interface in order to create a remediation project and a template, either from scratch or with the “Remediate Inventory” button. You can find this option on the screen that you previously saw on Ansible Tower when checking out risk/vulnerability information for specific hosts:

Ansible-Tower-Insights-Integration-17

This option is recommended, since it fills part of the Ansible Tower Template for you. Make sure that you name this template differently from the one you previously created, and select the appropriate playbook and the correct credentials (the same one that was selected previously):

Ansible-Tower-Insights-Integration-11

Make sure you select “Enable Escalation” at the bottom of your Template screen in order to perform some of the actions:

Ansible-Tower-Insights-Integration-15-1


Once everything is completed, you can launch that Template by clicking on the icon as before. Please note, some machines will need to reboot depending on what issues were found.
After the successful output completes, you’ll see that Red Hat Insights shows no high-critical vulnerabilities in your machines. You’ll only see the issues that can’t be resolved using a playbook (they will able to be fixed manually):

Ansible-Tower-Insights-Integration-13
To Conclude

Now you know how to utilize Red Hat Insights to correct any issues found within your Ansible Tower inventory by using Ansible Playbooks to automate remediation tasks!

We hope you found this information helpful. To dive deeper into what makes Red Hat Insights a great security and compliance tool, be sure to check out their blog.

We'd also like to mention another member of our Getting Started team, Jake Jacksonhelped in crafting this blog post. 

As always, happy automating!

Share:

Topics:
Ansible Tower, Getting Started, Insights


 

Bianca Henderson

Bianca is a Product Field Engineer, Technical Enablement for Red Hat Ansible Automation. You can find Bianca on LinkedIn and Twitter as @bizonks.


rss-icon  RSS Feed

Ansible Tower by Red Hat
Ansible Fest Austin 2018
Learn About Ansible Tower