Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Ansible for Real-Life Automation

You're reading from  Ansible for Real-Life Automation

Product type Book
Published in Sep 2022
Publisher Packt
ISBN-13 9781803235417
Pages 480 pages
Edition 1st Edition
Languages
Concepts
Author (1):
Gineesh Madapparambath Gineesh Madapparambath
Profile icon Gineesh Madapparambath

Table of Contents (22) Chapters

Preface 1. Part 1: Using Ansible as Your Automation Tool
2. Chapter 1: Ansible Automation – Introduction 3. Chapter 2: Starting with Simple Automation 4. Chapter 3: Automating Your Daily Jobs 5. Chapter 4: Exploring Collaboration in Automation Development 6. Part 2: Finding Use Cases and Integrations
7. Chapter 5: Expanding Your Automation Landscape 8. Chapter 6: Automating Microsoft Windows and Network Devices 9. Chapter 7: Managing Your Virtualization and Cloud Platforms 10. Chapter 8: Helping the Database Team with Automation 11. Chapter 9: Implementing Automation in a DevOps Workflow 12. Chapter 10: Managing Containers Using Ansible 13. Chapter 11: Managing Kubernetes Using Ansible 14. Chapter 12: Integrating Ansible with Your Tools 15. Chapter 13: Using Ansible for Secret Management 16. Part 3: Managing Your Automation Development Flow with Best Practices
17. Chapter 14: Keeping Automation Simple and Efficient 18. Chapter 15: Automating Non-Standard Platforms and Operations 19. Chapter 16: Ansible Automation Best Practices for Production 20. Index 21. Other Books You May Enjoy

Expanding Your Automation Landscape

It is important to find and apply automation at the right place and at the right level. Usually, when searching for automation use cases, people make mistakes by automating the inappropriate tasks and end up wasting money, effort, and time. This is the reason why we need to analyze the environment and day-to-day tasks and find the best tasks as automation candidates. We can use your statistical data such as event tickets, customer change requests, and project tasks to find this information.

In this chapter, you will learn about the following topics:

  • Finding your automation use cases in your day-to-day work
  • Automation feasibility and usability
  • Involving teams in the automation journey
  • The Ansible dynamic inventory

We will start with standard methods to analyze the tasks to find the highest number of tasks and check the feasibility of automation. We will explore the integration opportunities between IT service management...

Technical requirements

The following are the technical requirements to proceed with this chapter:

  • A Linux machine as an Ansible control node (with internet access)
  • One or more Linux machines as managed nodes with Red Hat repositories configured (if you are using non-RHEL machines, then make sure you have appropriate repositories configured to get packages and updates)
  • Basic knowledge of the AWS platform and an AWS account with one or more test machines created

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

Finding your automation use cases in your day-to-day work

We all know that every member of staff working in an IT environment is executing some tasks and most of the time, they repeat the same job every day. Looking around, we can see many examples, as follows:

  • A system engineer is building servers and virtual machines, installing packages, patching old systems, and more.
  • A network engineer is configuring the new network device and firewall devices, configuring ports and virtual local area networks (VLANs) based on requests, patching the device firmware, and many other things.
  • A developer is struggling to build his coding environment every time there is a new version of the programming language or software library. They are also spending a lot of time testing the code and waiting for test results.
  • A storage administrator is spending their valuable time provisioning the disk space and configuring the storage devices.
  • A database administrator is complaining about...

Automation feasibility and usability

We all need to understand that not all use cases or repeated jobs are suitable for automation. We need to study and confirm the feasibility of implementing the use case using Ansible automation.

Once you find the use cases, you can ask yourself several questions to understand the feasibility of implementation and usability of your automation use cases.

How complex is the use case?

You need to Consider the complexity of the use case or workflow you are trying to automate. If the use case is too complex, then you can split it into smaller use cases. You need to start with smaller use cases to avoid any possible delay or obstruction.

For example, if you want to automate the Linux operating system (OS) patching task, then split the job into multiple use cases as follows:

  1. Take a virtual machine snapshot.
  2. Back up the configuration.
  3. OS patching tasks.
  4. Verification of the OS after patching and reboot.
  5. Restore snapshot...

Involving teams in the automation journey

It is a common misunderstanding that the responsibility for finding use cases and implementing automation only falls to the systems team, platforms team, or infrastructure team. When we explore our work environment and day-to-day tasks, we will find thousands of tasks that we can automate using Ansible. It could be the database team managing database servers and instances, the network team handling network operations, or the application team who wants to deploy their application updates more effectively. Implementing automation in the environment is a collaborative journey, and we need support and guidance from different teams.

For example, typical database provisioning steps can be seen in Figure 5.5:

Figure 5.5 – Typical database provisioning tasks

Many of the tasks listed in Figure 5.5 can be automated using Ansible, and the workflow can be completed in minutes instead of days and weeks. The database team...

Ansible dynamic inventory

It is easy to manage your managed node information inside static inventory files when you have a smaller number of nodes or an almost fixed set of assets, such as bare-metal servers or virtual machines that are not frequently recreated. But, if your environment contains many dynamic nodes, such as virtual machines on multiple public or private cloud platforms, Kubernetes, or OpenShift platforms, then keeping your managed node information inside static files will be difficult, as you need to keep track of the changes and update your inventory files with them, including IP addresses, login credentials, and more. In such cases, you can use the dynamic inventory features in Ansible, which are basically some custom scripts and inventory plugins that collect inventory information from these virtualization or container platforms.

When you pass the dynamic inventories to Ansible, the inventory plugins will be executed and will collect the details of managed nodes...

Summary

In this chapter, you have learned methods to find automation use cases in your workplace and determine the feasibility and usability of these automation use cases. You have also explored the importance of collaboration between teams to implement better automation use cases. Later in the chapter, you learned how to use the Ansible dynamic inventory and practiced using the Ansible inventory plugin with the AWS ec2 inventory plugin.

In the next chapter, we will learn the basics of Windows automation and the remote connection methods available. We will also learn the basics of network automation using Ansible with practice sections.

Further reading

lock icon The rest of the chapter is locked
You have been reading a chapter from
Ansible for Real-Life Automation
Published in: Sep 2022 Publisher: Packt ISBN-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.
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 AU $19.99/month. Cancel anytime}