IT Infrastructure Automation Using Ansible
eBook - ePub

IT Infrastructure Automation Using Ansible

Guidelines to Automate the Network, Windows, Linux, and Cloud Administration

Waqas Irtaza

Buch teilen
  1. English
  2. ePUB (handyfreundlich)
  3. Über iOS und Android verfügbar
eBook - ePub

IT Infrastructure Automation Using Ansible

Guidelines to Automate the Network, Windows, Linux, and Cloud Administration

Waqas Irtaza

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Über dieses Buch

Expert solutions to automate routine IT tasks using Ansible.

Key Features
? Single handy guide for all IT teams to bring automation throughout the enterprise.
? In-depth practical demonstration of various automation use-cases on the IT infrastructure.
? Expert-led guidelines and best practices to write Ansible playbooks without any errors.

Description
This book deals with all aspects of Ansible IT infrastructure automation. While reading this book, you should look for automation opportunities in your current role and automate time-consuming and repetitive tasks using Ansible.This book contains Ansible fundamentals assuming you are totally new to Ansible. Proper instructions for setting up the laboratory environment to implement each concept are explained and covered in detail. This book is equipped with practical examples, use-cases and modules on the network. The system and cloud management are practically demonstrated in the book. You will learn to automate all the common administrative tasks throughout the entire IT infrastructure. This book will help establish and build the proficiency of your automation skills, and you can start making the best use of Ansible in enterprise automation.

What you will learn
? Install Ansible and learn the fundamentals.
? Use practical examples and learn about the loop, conditional statements, and variables.
? Understand the Ansible network modules and how to apply them in our day-to-day network management.
? Learn to automate the Windows and Linux infrastructure using Ansible.
? Automate routine administrative tasks for AWS, Azure, Google Cloud.
? Explore how to use Ansible for Docker and Kubernetes.

Who this book is for
This book is for all IT students and professionals who want to manage or plan to administer the IT infrastructure. Knowing the basic Linux command-line would be good although not mandatory.

Table of Contents
1. Up and Running with Ansible
2. Ansible Basics
3. Ansible Advance Concepts
4. Ansible for Network Administration
5. Ansible for System Administration
6. Ansible for Cloud Administration
7. Ansible Tips and Tricks

Häufig gestellte Fragen

Wie kann ich mein Abo kündigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kündigen“ – ganz einfach. Nachdem du gekündigt hast, bleibt deine Mitgliedschaft für den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich Bücher herunterladen?
Derzeit stehen all unsere auf Mobilgeräte reagierenden ePub-Bücher zum Download über die App zur Verfügung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die übrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den Aboplänen?
Mit beiden Aboplänen erhältst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst für Lehrbücher, bei dem du für weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhältst. Mit über 1 Million Büchern zu über 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
Unterstützt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nächsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist IT Infrastructure Automation Using Ansible als Online-PDF/ePub verfügbar?
Ja, du hast Zugang zu IT Infrastructure Automation Using Ansible von Waqas Irtaza im PDF- und/oder ePub-Format sowie zu anderen beliebten Büchern aus Informatik & Systemverwaltung. Aus unserem Katalog stehen dir über 1 Million Bücher zur Verfügung.

Information

Jahr
2021
ISBN
9789391030032

CHAPTER 1

Up and Running with Ansible

Ansible is a simple open-source engine which automates the application deployment, infrastructure service orchestration, cloud provisioning, and many other IT tools. Ansible is completely agentless, which means that it works by connecting your nodes through SSH. Most of the current technologies use SSH as a default administration tool, whether it is a public or a private cloud platform, networking equipment, or a locally hosted ESX, Windows, or Linux servers. Henceforth, Ansible has a diverse scope.
Moreover, if you want the other methods for a remote connection like Kerberos, those options are also available. So, let’s begin our journey and start exploring what to expect from this chapter.

Structure

In this chapter, we will cover the following topics:
  • Introduction to Ansible
  • Lab setup
  • Important concepts about Ansible
  • Basic understanding of YAML

Objective

After studying this chapter, you should be able to do the following:
  • Understand why Ansible is popular.
  • Install Ansible and set up your environment.
  • Understand the Ansible components.
  • Understand the YAML syntax.

Introduction to Ansible

If you are a Systems Administrator, Network Administrator, or just anybody working in the IT, you were probably involved in doing a lot of repetitive tasks in your environment, whether it was to configure thousands of routers and switches, create new virtual machines, apply configurations, patch bulk of servers, migrations, deploy applications, or even perform security and compliance audits.
All of these repetitive tasks involve execution of similar commands on thousands of different devices, while maintaining the right sequence of events. Smart people develop scripts to automate these tasks, but it requires coding skills; regular IT administrators don’t have the professional coding skills, and an IT developer with good coding skills don’t have the strong infrastructure knowledge. Hence, there is a gap which Ansible leverages.
Ansible is a powerful IT automation tool that you can quickly learn. It's simple enough for everyone in IT, yet powerful enough to automate even the most complex deployments.
The following are some products related to Ansible:
  • Ansible Core: An open-source automation platform.
  • Ansible Galaxy: A website with a large catalogue of community created roles.
  • Ansible Tower: A web application and REST API solution for Ansible.
The main focus of the book is the Ansible core. The following are some of the Ansible use cases:
  • Configuration management
  • Deployment
  • Orchestration
  • Provisioning
Let's explore the use cases with examples. Imagine you have a number of servers in your environment that you would like to patch and restart in a particular order. Some of them are application servers and the others are database servers. So, first you would patch the servers, and power down the application servers, followed by the database servers, then power up the database servers, and once the database is online, then power up the application servers. You could write an Ansible playbook to get this done in a matter of minutes and simply invoke the Ansible playbook every time you wish to perform this patching activity.
Similarly, if you have to enable the port security on all the switches in the network, which is a repetitive work across the network, and if this needs to be performed on thousands of switches, a simple Ansible playbook can achieve this task.
Let's take a look at a complex example. Let’s suppose, we are setting up a complex infrastructure that spans across public and private cloud and hundreds of VMs. With Ansible, you could provision the hosts on public clouds like Azure or AWS and provision private cloud like OpenStack or in VMware based infrastructure and move onto configuring the applications on those systems and set up communications between them. There are a lot of built-in modules available in Ansible that supports these kinds of operations and many more. We will be exploring them in the following chapters.
The following block diagram will clarify the Ansible key components:
Figure 1.1: Ansible key components
To understand better, the following is the definition of each Ansible component:
  • Ansible Control Node: Ansible Control Node is any machine which has Ansible installed. It must be a Linux machine; it can’t be any Windows machine. This is the one machine where the installation is required.
  • Ansible Managed Nodes: Ansible Managed Nodes are servers or any IT devices, which we want to manage through Ansible. Ansible Managed Nodes are also called hosts. Ansible installation is not required on hosts.
  • Inventory: Inventory is a list of hosts. We can organize the hosts by nesting, and creating groups for scaling. Static and dynamic inventories are available, which we will discuss later.
  • Playbooks: A Playbook is an ordered list of saved tasks, which can run repeatedly. Playbooks gives a programmable flavor to Ansible by allowing variable, loops, and conditional statements. Playbooks are written in YAML format.

Lab setup

Ansible installation is extremely simple; just a couple of commands and you have a fully functional Ansible control node. However, our goal is not just to install Ansible, but to understand the infrastructure requirement and have a fully functional lab to follow along the practical examples. Let’s prepare the lab by following these processes.

Infrastructure preparation for Ansible

We will be setting up an entire lab environment on our laptop from scratch. For this, we will use a virtualization tool called Oracle VirtualBox, since it is open source and works with all the flavors of operating systems like Windows, Linux, and OSX. We will first install the Oracle VirtualBox on our laptop and then install the CentOS or Ubuntu operating systems; I have created one Ansible control node on Ubuntu and four managed nodes, two on CentOS and two on Ubuntu. The following screenshot shows the VMs on VirtualBox:
Figure 1.2: VMs on VirtualBox
Having four managed nodes is not required if you have a low specification laptop, a single Linux host can also be used as both the control node and the managed nodes.
We will not cover the CentOS/Ubuntu installation, since it is out of our scope and a lot of YouTube videos are available to achieve it. We will cover the Ansible installation after the operating system installation.
The following is the basic configuration on all the hosts before starting the Ansible installation:
Figure 1.3: Basic configuration
Ansible works fine with IP address but it doesn’t look professional. Therefore, we will resolve the IP address to host name, which is not compulsory. We can copy the following cont...

Inhaltsverzeichnis