Reader small image

You're reading from  Ansible for Real-Life Automation

Product typeBook
Published inSep 2022
PublisherPackt
ISBN-139781803235417
Edition1st Edition
Concepts
Right arrow
Author (1)
Gineesh Madapparambath
Gineesh Madapparambath
author image
Gineesh Madapparambath

Gineesh Madapparambath has over 15 years of experience in IT service management and consultancy with experience in planning, deploying, and supporting Linux-based projects. He has designed, developed, and deployed automation solutions based on Ansible and Ansible Automation Platform (formerly Ansible Tower) for bare metal and virtual server building, patching, container management, network operations, and custom monitoring. Gineesh has coordinated, designed, and deployed servers in data centers globally and has cross-cultural experience in classic, private cloud (OpenStack and VM ware), and public cloud environments (AWS, Azure, and Google Cloud Platform). Gineesh has handled multiple roles such as systems engineer, automation specialist, infrastructure designer, and content author. His primary focus is on IT and application automation using Ansible, containerization using OpenShift (and Kubernetes), and infrastructure automation using Terraform.
Read more about Gineesh Madapparambath

Right arrow

Integrating Ansible with Your Tools

As an organization grows its IT infrastructure, more and more tools are often needed to solve the technical challenges. Instead of these tools working alone in silos, it is desirable to implement integration between these tools to increase efficiency and scalability. As an example, the IT Service Management (ITSM) tool can send an alert to approvers, or the container platform can trigger a new deployment of the application when a new version has been developed by the team. There are an immeasurable number of opportunities in terms of integrating multiple siloed tools in IT infrastructure.

The same goes for automation as well; Ansible can be used as the key automation tool for implementing integration between multiple infrastructure and application support tools. In the previous chapters, you learned about the Ansible automation and integration opportunities for the infrastructure (public and private cloud), DevOps, networks, applications, and...

Technical requirements

You will need the following technical requirements for this chapter:

  • One or more Linux machines with Red Hat repositories configured. If you are using other Linux operating systems instead of Red Hat Enterprise Linux (RHEL) machines, then make sure you have the appropriate repositories configured to get packages and updates.
  • Access to Red Hat AAP.
  • A GitHub account.
  • A Jenkins server and basic knowledge about Jenkins pipelines.
  • A Slack application account and basic knowledge about Slack usage.

A single 60-day self-supported subscription to Red Hat AAP is available for testing AAP and its features. Please refer to https://www.redhat.com/en/technologies/management/ansible/trial to learn more about the AAP trial subscription.

All the Ansible artifacts, commands, and snippets for this chapter can be found in this book’s GitHub repository at https://github.com/PacktPublishing/Ansible-for-Real-life-Automation/tree/main/Chapter...

Introduction to Red Hat AAP

So far, you have learned how to use Ansible, develop playbooks, create roles, use content collections, and more for your use cases. Anyone can install and use Ansible in their workstation or some random servers in an environment and use them for their automation use cases. However, there won’t be any standardization, traces, or accountability as each person works on their methods and practices. This will result in the following challenges in the organization:

  • Individuals work in silos, which will result in no collaboration in the workplace.
  • Automation artifacts (playbooks, roles, and collections) are not shared between individuals or teams.
  • No logging or auditing options will be available since the automation is running on an individual’s workstation or some random servers.
  • Less control over who can execute the playbooks or automated jobs.
  • Difficulty keeping secrets and credentials.
  • Lack of job scheduling and monitoring...

Red Hat AAP components

Red Hat AAP is an automation suite that contains multiple components, as shown in the following diagram:

Figure 12.4 – High-level diagram of Red Hat AAP 2.1 components (source: https://www.ansible.com/blog/introducing-red-hat-ansible-automation-platform-2.1)

In the following sections, you will learn about the different components of AAP, such as the automation controller, execution environments, and automation mesh.

Ansible automation controller

The automation controller was referred to as Ansible Tower previously. It is the control plane and the core component of AAP. With the introduction of the Ansible automation controller, the control plane components (WebUI and API) become decoupled from the execution environment (EE), which also helps the solution with additional execution nodes.

With the automation controller, we can manage the AAP operations from the WebUI, such as managing remote nodes (inventory), credentials...

Database management using Red Hat AAP

In Chapter 8, Helping the Database Team with Automation, you learned how to use Ansible to automate database creation and user management operations. This section will reuse the same Ansible artifacts but in a different repository and execute the job from Red Hat AAP.

The following are the prerequisites for this section:

Job templates are the core resources in the automation controller, but a job template requires few other resources as dependencies.

Figure 12.10 – Components and dependencies in Ansible Automation Platform

You will learn the basic operations in the Ansible automation controller and create various resources, as follows:

  • Organizations...

Integrating Jenkins with AAP

Jenkins (https://www.jenkins.io) is a well-known open source tool (written in the Java programming language) that can be used to implement continuous integration/continuous delivery (CI/CD) and deployment solutions. Automating the build and deployment is the key to effective DevOps practices. As shown in the following diagram, developers and testers can offload such tasks to CI/CD tools such as Jenkins:

Figure 12.37 – CI/CD workflow using Jenkins

Jenkins can execute many tasks natively or use plugins but for complex tasks, Jenkins can utilize the appropriate tools. For example, instead of calling complex scripts or commands inside the Jenkins pipeline, a specific job can be offloaded to the Ansible automation controller, as shown in the following diagram:

Figure 12.38 – Jenkins integration with AAP for database operations

The automation controller will execute the job based on the parameters...

Integrating an automation controller with Slack and notification services

In Chapter 3, Automating Your Daily Jobs, you learned how to use the mail module to send custom emails using Ansible. In the Ansible automation controller, it is possible to configure Notifications to send emails and messages based on job start, success, or fail status. The following notification types are supported in the automation controller:

  • Email
  • IRC
  • Webhook
  • Grafana
  • Slack
  • Mattermost
  • PagerDuty
  • Rocket.Chat
  • Twilio

Multiple notifications can be created and required notifications can be enabled for the job template.

Creating email notifications in the automation controller

To create an email notification, open the Notifications tab from the dashboard and click Add. Select the type as Email and fill in the details, as shown in the following screenshot:

  • If the email server is open (no authentication required), then leave the Username and Password fields...

Summary

In this chapter, you learned about the enterprise automation solution called Red Hat AAP. First, you learned about the benefits of using AAP and its features. You also learned about the different components of AAP, such as its execution environment, automation controller, automation mesh, and Automation Hub.

After that, you learned more about the automation controller by creating different resources such as organizations, projects, inventories, managed nodes and groups, credential job templates with survey forms and extra variables, and more. You also learned how to integrate the Jenkins CI/CD tool with Red Hat AAP to trigger the jobs automatically as part of the build and deployment pipeline.

Finally, you explored the notification options in the automation controller and tested them with different types of notifications such as email and Slack. All this knowledge will help you implement and manage automation using AAP and integrate AAP with different tools in your environment...

Further reading

To learn more about the topics that were covered in this chapter, take a look at the following resources:

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Ansible for Real-Life Automation
Published in: Sep 2022Publisher: PacktISBN-13: 9781803235417
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Gineesh Madapparambath

Gineesh Madapparambath has over 15 years of experience in IT service management and consultancy with experience in planning, deploying, and supporting Linux-based projects. He has designed, developed, and deployed automation solutions based on Ansible and Ansible Automation Platform (formerly Ansible Tower) for bare metal and virtual server building, patching, container management, network operations, and custom monitoring. Gineesh has coordinated, designed, and deployed servers in data centers globally and has cross-cultural experience in classic, private cloud (OpenStack and VM ware), and public cloud environments (AWS, Azure, and Google Cloud Platform). Gineesh has handled multiple roles such as systems engineer, automation specialist, infrastructure designer, and content author. His primary focus is on IT and application automation using Ansible, containerization using OpenShift (and Kubernetes), and infrastructure automation using Terraform.
Read more about Gineesh Madapparambath