Fundamentals of Ansible
Published by O'Reilly Media, Inc.
Learn the essentials of configuration as code
Course outcomes
- Understand Ansible constructs including modules, plays and playbooks, roles, and variables
- Recognize how Ansible projects are organized
- Get hands-on practice with Ansible ad-hoc commands and playbooks
Course description
In a world where automation is king, when it comes to configuration management, Ansible rules. Ansible, an open source project from Red Hat, allows you to automate configuration, including installing software, applying security patches, and managing networks across the whole spectrum—locally, on-prem, or in the cloud.
Join expert Raju Gandhi to learn Ansible from the ground up. In this exercise-driven course, you’ll see how to declare your inventory, use modules to run arbitrary tasks on hosts, collect related tasks into playbooks, make reusable units of work using roles, and use variables. You’ll come away with a comprehensive understanding of how Ansible works and how you can start automating away the mundanities of server configuration.
What you’ll learn and how you can apply it
- Use good practices and hygiene for Ansible projects
This live event is for you because...
- You’re a DevOps engineer working to automate server configuration.
- You work with infrastructure/platform as a service to internal customers.
- You want to become a DevOps/SRE/automation engineer.
Prerequisites
- A computer with Vagrant and Ansible installed
- A basic understanding of Linux usage and commands
Recommended preparation:
Recommended follow-up:
- Read Ansible: Up & Running (book)
- Watch Ansible: From Basics to Guru (on-demand course)
- Work in the Ansible Sandbox
Schedule
The time frames are only estimates and may vary according to how the class is progressing.
Introduction (25 minutes)
- Presentation: What is DevOps?; configuration as code; cattle, not pets; consistency across machines; SDLC for infrastructure; Ansible; where Ansible sits in the DevOps stack
How Ansible works (35 minutes)
- Presentation: Agentless; declarative; push-based; SSH; control box versus inventory
- Hands-on exercise: Check your installation
- Break
Beginning Ansible (25 minutes)
- Presentation: Understanding Ansible inventories; modules; idempotency
- Hands-on exercise: Run your first module
Using playbooks (35 minutes)
- Presentation: Role of playbooks; basic structure; using roles in playbooks; pre_ and post_tasks
- Hands-on exercise: Run your first playbook; define a post_task in a playbook
- Break
Variables (25 minutes)
- Presentation: Defining; global/group_vars/host_vars
- Hands-on exercise: Define a group_var for a particular group of servers
Roles (35 minutes)
- Presentation: Role of roles; directory structure (tasks, files, templates, templating using Jinja); ensuring idempotency
- Hands-on exercise: Explore the role in provided repository
- Break
Managing secrets (15 minutes)
- Presentation: Using HashiCorp vault
- Hands-on exercise: Use the command line to encrypt a string and use it in the a group_vars
Validation (15 minutes)
- Presentation: Syntax check; list hosts; list tasks; C or check; linting; debug module; assert module; testing
- Hands-on exercise: Check your playbook using Ansible command line
Caveats (15 minutes)
- Presentation: Running continuously; have to clean up yourself; modules can have dependencies; don't use all kinds of variables; convention over configuration
Open source (15 minutes)
- Presentation: Ansible Galaxy; Red Hat automation controller
Your Instructor
Raju Gandhi
Raju Gandhi is the founder of DefMacro Software as well as a consultant, author, teacher, and regularly invited speaker at conferences around the world. As both a software developer and a teacher, he believes in keeping things simple, preferring to understand and explain the “why” as opposed to the “how.” Raju blogs at LooselyTyped.com and lives in Columbus, Ohio, along with his wonderful wife, Michelle, their sons, Mason and Micah, daughter, Delphine, and three furry family members, Buddy, Skye, and Princess Zara. You can find his contact information at Rajugandhi.com. He’s always looking to make new friends.