Skip to content
ImagineWorld

Learn Ansible

node_idnode-book_learn-ansible
node_typenode-book
schema_profileworld.node_book.v1
statusactive
orthogonal_scopemanifold, entropy, authority, state
manifoldworld
entropymedium
authorityinforms
stateexternal
domainimagineworld.net
node_interiorrosetta_contract
unisonone evidence claim read five ways: seated in the platforms field, the work teaches Ansible — configuration and orchestration automated through playbooks — its framework, regime, and stance agreeing on what it is
governed_byWORLD-MANIFOLD
constitutional_citationCONSTITUTION
peer_node_books
book_titleLearn Ansible
book_authorRuss McKendrick
book_publisherPackt Publishing
book_year2024
total_chapters16
updated_at2026-10-14T05:45:17Z
book_copyrightCopyright © 2024 Packt Publishing
book_isbn9781835088913
local graph

node-book_learn-ansible_chapter-01-installing-and-running-ansible — Installing and Running Ansible

node-book_learn-ansible_chapter-02-exploring-ansible-galaxy — Exploring Ansible Galaxy

node-book_learn-ansible_chapter-03-the-ansible-commands — The Ansible Commands

node-book_learn-ansible_chapter-04-deploying-a-lamp-stack — Deploying a LAMP Stack

node-book_learn-ansible_chapter-05-deploying-wordpress — Deploying WordPress

node-book_learn-ansible_chapter-06-targeting-multiple-distributions — Targeting Multiple Distributions

node-book_learn-ansible_chapter-07-ansible-windows-modules — Ansible Windows Modules

node-book_learn-ansible_chapter-08-ansible-network-modules — Ansible Network Modules

node-book_learn-ansible_chapter-09-moving-to-the-cloud — Moving to the Cloud

node-book_learn-ansible_chapter-10-building-out-a-cloud-network — Building Out a Cloud Network

node-book_learn-ansible_chapter-11-highly-available-cloud-deployments — Highly Available Cloud Deployments

node-book_learn-ansible_chapter-12-building-out-a-vmware-deployment — Building Out a VMware Deployment

node-book_learn-ansible_chapter-13-scanning-your-ansible-playbooks — Scanning Your Ansible Playbooks

node-book_learn-ansible_chapter-14-hardening-your-servers-using-ansible — Hardening Your Servers Using Ansible

node-book_learn-ansible_chapter-15-using-ansible-with-github-actions-and-azure-devops — Using Ansible with GitHub Actions and Azure DevOps

node-book_learn-ansible_chapter-16-introducing-ansible-awx-and-red-hat-ansible-automation-platf — Introducing Ansible AWX and Red Hat Ansible Automation Platform

Ansible, an open source orchestration tool, has experienced significant growth and is now a comprehensive orchestration and configuration management solution under Red Hat’s ownership. This book will guide you through writing playbooks using core, vendor-supplied, and community Ansible modules to deploy various systems, from simple LAMP stacks to highly available public cloud infrastructures.

By the end of this book, you will have acquired the following skills:

  • A solid foundational knowledge of Ansible and its various supporting tools
  • The ability to write your own custom playbooks to configure both Linux and Windows servers
  • The ability to define highly available cloud infrastructures using code, enabling the easy distribution of your infrastructure configuration alongside your code base
  • An understanding of how to use Ansible Galaxy, use community-contributed roles, and create and contribute your own roles
  • The ability to run your Ansible playbooks using GitHub Actions and Azure DevOps
  • The ability to deploy and configure Ansible AWX, a web-based interface for Ansible
  • Various skills gained from exploring several use cases demonstrating how to integrate Ansible into your daily tasks and projects

You will have a solid understanding of how to incorporate Ansible into your everyday responsibilities as a system administrator, developer, or DevOps practitioner.

This book is written for people in the following roles who want to streamline their workflows by leveraging Ansible’s capabilities:

  • System administrators*:* This book will help you automate repetitive tasks and ensure consistent configurations across your systems if you manage and maintain servers, networks, and other infrastructure components.
  • Developers*:* As a developer, you can benefit from this book by learning how to use Ansible to provision and manage development environments, deploy applications, and integrate infrastructure-as-code practices into your development workflow.
  • DevOps practitioners*:* If you are a DevOps practitioner responsible for bridging the gap between development and operations, this book will provide the tools and knowledge to create efficient, repeatable, and scalable deployment processes using Ansible.

No prior experience with Ansible is necessary to get started with this book.

Chapter 1, Installing and Running Ansible, discusses the problems Ansible was developed to solve. After covering its background, we will work through installing Ansible on macOS and Linux. We will also discuss why there is no native Windows installer and cover installing Ansible on the Windows Subsystem for Linux.

Chapter 2, Exploring Ansible Galaxy, discusses Ansible Galaxy, an online repository of community and vendor-contributed roles. In this chapter, we will discover some of the best roles available, how to use them, and how to create your role and have it hosted on Ansible Galaxy.

Chapter 3, The Ansible Commands, explains how we examine Ansible commands before writing and executing more advanced playbooks. Here, we will cover using the tools that make up Ansible.

Chapter 4, Deploying a LAMP Stack, discusses deploying a complete LAMP stack using the various core modules that ship with Ansible. We will target the Ubuntu machine that is running locally.

Chapter 5, Deploying WordPress, expands on the LAMP stack playbook, which we deployed in the previous chapter as our base. We will use Ansible to download, install, and configure WordPress – a popular CMS.

Chapter 6, Targeting Multiple Distributions, explains how we will adapt the playbook from the previous chapter so it can run against both Debian, which we have been targeting so far, and Red Hat-based Linux distributions.

Chapter 7, Ansible Windows Modules, explores the ever-growing collection of Ansible modules that support and interact with Windows-based servers.

Chapter 8, Ansible Network Modules, discusses network modules available from various vendors through Ansible Galaxy. Due to their requirements, we will only discuss the functionality of these modules.

Chapter 9, Moving to the Cloud, discusses how we can move from using local virtual machines to using Ansible to deploy network and compute resources in Microsoft Azure. Then, we will use the playbook from the previous chapters to install and configure a LAMP stack and WordPress.

Chapter 10, Building Out a Cloud Network, since we will have just launched a virtual machine in Microsoft Azure, moves on to Amazon Web Services; however, before launching any compute instances, we must create a network in which they can be hosted.

Chapter 11, Highly Available Cloud Deployments, continues our Amazon Web Services deployment. We will start deploying compute and storage services into the network we created in the previous chapter, and by the end of the chapter, we will have a highly available WordPress installation.

Chapter 12, Building Out a VMware Deployment, discusses the modules that allow you to interact with the various components of a typical VMware installation.

Chapter 13, Scanning Your Ansible Playbooks, provides practical examples of running two third-party tools, Checkov and KICS. These tools are designed to scan your Ansible playbook code for common mistakes and potential security problems.

Chapter 14, Hardening Your Servers Using Ansible, explains how to install and execute OpenSCAP. We will also automatically generate remediation Ansible playbooks and Bash scripts to resolve any problems found during the scan. We will also look at running WPScan and OWASP ZAP scans against the resources deployed using the playbooks from previous chapters.

Chapter 15, Using Ansible with GitHub Actions and Azure DevOps, will examine running our Ansible playbook books from these two CI/CD platforms. As neither has native Ansible support, we will discuss how to install and run Ansible to get the most out of the platforms.

Chapter 16, Introducing Ansible AWX and Red Hat Ansible Automation Platform, examines two web-based interfaces: we will discuss the commercial Red Hat Ansible Automation Platform and then take a deep dive into deploying and configuring the open source Ansible AWX.

Chapter 17, Next Steps with Ansible, discusses how Ansible can be integrated into our day-to-day workflows, from interacting with collaboration services to troubleshooting your playbooks with the built-in debugger. We will also look at real-world examples of how I have used Ansible across organizations I have worked with.

To get the most out of this book, I assume that you have the following:

  • Some experience of using the command line on both Linux-based machines and macOS
  • A basic understanding of how to install and configure services on a Linux server
  • A working knowledge of services and languages such as Git, YAML, and virtualization
    Software/hardware covered in the bookOperating system requirements
    AnsiblemacOS, Linux, or Windows via Subsystem for Linux
    Canonical MultipassmacOS, Linux, or Windows
    Various CLIs for public cloud providersmacOS, Linux, or Windows via Subsystem for Linux

If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

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: “As you can see, it is calling a variable called {{ apache_packages }}, which is defined in roles/apache/defaults/main.yml as follows.”

A block of code is set as follows:

- name: "Install apache packages"
ansible.builtin.apt:
state: "present"
pkg: "{{ apache_packages }}"

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

- name: "Install apache packages"
ansible.builtin.apt:
state: "present"
pkg: "{{ apache_packages }}"

Any command-line input or output is written as follows:

$ ansible-playbook -i hosts site.yml

Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “You can leave the remaining options at their defaults and then click on the Create repository button at the end of the form.”

Tips or important notes

Appear like this.


Source: