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

Preface

Automation is the key to IT modernization, and using the right automation tool is a crucial step in the automation journey for organizations. Ansible is an open source automation software that you can use for automating most of your operations with IT and application infrastructure components including servers, storage, network, and application platforms. Ansible is one of the most well-known open source automation tools in the IT world right now and has strong community support, with more than 5,000 active contributors around the world.

Ansible is not a learn-by-reading technology. This book will help you to understand and practice the automation capabilities of Ansible with actual playbooks, configurations, and practical examples. It will help you to understand the basics of Ansible automation and slowly, you will learn how to use Ansible for automating your day-to-day tasks.

You will learn real-life IT automation use cases with practical examples, such as simple system reports, security scanning, and weekly rebooting Linux machines. After that, the book will teach you how to implement collaboration in Ansible automation and how to automate other devices and platforms, such as Microsoft Windows, network devices, VMware, AWS, and GCP. You will also learn how to use Ansible in a DevOps workflow with Jenkins integration and container and application management on Kubernetes. To expand your knowledge further on enterprise automation, the book will also teach you about Red Hat Ansible Automation Platform, secret management, and Ansible integration with other tools, such as Jira and ServiceNow. There are chapters in this book that cover how to automate non-supported devices and platforms using raw commands and API calls using Ansible. Before the book concludes, you will also explore the Ansible best practices for storing managed node information, variables, credentials, and playbooks for production environments.

Upon finishing Ansible for Real-Life Automation, you will have the skills to find automation use cases in your work environment and design and deploy automation solutions using Ansible.

Who this book is for

This book is intended for systems engineers and DevOps engineers who want to use Ansible as their automation tool. The book provides references and practical examples to start IT automation within your work environment.

What this book covers

Chapter 1, Ansible Automation – Introduction, gives you an introduction to Ansible and teaches you how to install and configure Ansible and configure managed nodes.

Chapter 2, Starting with Simple Automation, teaches you how to identify manual tasks to automate, find suitable Ansible modules, and use text editors for Ansible.

Chapter 3, Automating Your Daily Jobs, is the chapter where you started developing Ansible playbooks for real-life use cases, such as system information gathering, system reboot, and security scanning. You will also learn about Ansible collections, secrets in Ansible, and automating notifications.

Chapter 4, Exploring Collaboration in Automation Development, teaches you about the importance of version control in IT automation and the best practices to use source control management for storing Ansible artifacts.

Chapter 5, Expanding Your Automation Landscape, covers the methods to find automation use cases from your workplace and check the feasibility of automation. This chapter also teaches you how to use a dynamic inventory in Ansible.

Chapter 6, Automating Microsoft Windows and Network Devices, is where you discover the possibilities to automate Microsoft Windows and network devices using Ansible. This chapter will cover practical examples for Windows automation, VyOS fact gathering, and access control list creation on a Cisco ASA device.

Chapter 7, Managing Your Virtualization and Cloud Platforms, teaches you about Infrastructure as Code (IaC) and the methods to use Ansible as an IaC tool with practical examples for managing the VMware, AWS, and GCP platforms.

Chapter 8, Helping the Database Team with Automation, covers an introduction to database operations, such as installing the database server and creating databases, tables, and database users.

Chapter 9, Implementing Automation in a DevOps Workflow, is where you will be introduced to DevOps and the usage of Ansible in a DevOps workflow, with practical examples for reducing deployment time and managing application load balancers and rolling updates. The chapter also covers how to integrate Ansible with Terraform.

Chapter 10, Managing Containers Using Ansible, continues the look at Ansible and DevOps by covering the methods to manage application containers using Ansible. This chapter covers practical use cases such as deploying container hosts, using Ansible in CI/CD pipelines, building containers, and managing multi-container applications.

Chapter 11, Managing Kubernetes Using Ansible, goes into more container-based use cases with an introduction to Kubernetes and the method to manage Kubernetes clusters and applications using Ansible. The chapter teaches you how to deploy, manage, and scale containerized applications on the Kubernetes platform.

Chapter 12, Integrating Ansible with Your Tools, covers the introduction to the enterprise automation tool Red Hat Ansible Automation Platform (AAP). This chapter teaches you methods for using AAP for automation with practical examples, such as database management, Jenkins integration, and Slack notification.

Chapter 13, Using Ansible for Secret Management, explains the methods to handle sensitive data in automation using Ansible Vault and how to use encrypted data in Ansible playbooks.

Chapter 14, Keeping Automation Simple and Efficient, teaches you about the survey forms in Ansible automation controller and workflow job templates. This chapter also covers security automation and integrating Ansible with monitoring tools.

Chapter 15, Automating Non-Standard Platforms and Operations, teaches you the automate to handle non-supported platforms using raw commands and API commands. This chapter also teaches you how to develop custom Ansible modules for when there are no modules available.

Chapter 16, Ansible Automation Best Practices for Production, is where you learn the production best practices for Ansible, such as organizing Ansible artifacts, inventories, and variables. This chapter also covers the best practices for credential management and playbook development.

To get the most out of this book

In this book, I will first guide you through the installation and deployment of the Ansible automation tool, and later, I will explain some real IT use cases and methods to use Ansible for automating such operations. Since the focus of the book is on different automation use cases, some of the chapters might have additional technical requirements, such as basic knowledge of a specific technology or access to a lab environment (such as a Kubernetes cluster). For this, I have also covered the methods to arrange the development environment if you want to practice. Always refer to the Ansible documentation at https://docs.ansible.com and other provided links in the chapters for further learning.

For testing and development, you can get no-cost RHEL (https://developers.redhat.com/articles/faqs-no-cost-red-hat-enterprise-linux) subscriptions. It is also possible to replace RHEL8 with other operating systems, such as Fedora, CentOS, or Ubuntu, but you might need to adjust some of the commands and modules in the playbook.

If you are reading a soft copy or digital version of this book, it is advised to type the commands and develop the playbooks by yourself rather than copy-pasting from the book. However, you can access the code, snippets, and playbooks from the book’s GitHub repository (a link is available in the next section) for reference.

Download the example code files

You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/Ansible-for-Real-life-Automation. If there’s an update to the code, it will be updated on the existing GitHub repository. You can point out any problems or issues in the code samples and submit any questions related to the book by raising issue tickets in this GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://packt.link/TVh0m.

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “Configure the KUBECONFIG environment variable as our kubeconfig filename is different (/home/ansible/.kube/minikube-config) from the default filename (/home/ansible/.kube/config).”

A block of code is set as follows:

[ansible@ansible Chapter-11]$ export KUBECONFIG=$KUBECONFIG:/home/ansible/.kube/minikube-config

Some of the code snippets and outputs are displayed as images for better readability and brevity.

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: “Update your job template and add new vault credentials by going to Job Template | Edit, then clicking on the Search button near Credential.”

Tips or Important Notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at customercare@packtpub.com.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at copyright@packt.com with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Share Your Thoughts

Once you’ve read Ansible for Real Life Automation, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.

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 ₹800/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