Ansible Playbook Essentials

Packt Publishing Limited
  • 1. Auflage
  • |
  • erschienen am 5. August 2015
  • |
  • 168 Seiten
E-Book | ePUB mit Adobe DRM | Systemvoraussetzungen
978-1-78439-561-2 (ISBN)
Design automation blueprints using Ansible's playbooks to orchestrate and manage your multi-tier infrastructureAbout This BookGet to grips with Ansible's features such as orchestration, automatic node discovery, and data encryptionCreate data-driven, modular and reusable automation code with Ansible roles, facts, variables, and templatesA step-by-step approach to automating and managing system and application configurations effectively using Ansible's playbooksWho This Book Is ForIf you are a systems or automation engineer who intends to automate common infrastructure tasks, deploy applications, and use orchestration to configure systems in a co-ordinated manner, then this book is for you. Some understanding of the Linux/UNIX command line interface is expected.What You Will LearnWrite simple tasks and playsOrganize code into a reusable, modular structureSeparate code from data using variables and Jinja2 templatesRun custom commands and scripts using Ansible's command modulesControl execution flow based on conditionalsIntegrate nodes and discover topology information about other nodes in the clusterEncrypt data with ansible-vaultCreate environments with isolated configurations to match application development workflowOrchestrate infrastructure and deploy applications in a coordinated mannerIn DetailAnsible combines configuration management, orchestration, and parallel command execution into a single tool. Its batteries-included approach and built-in module library makes it easy to integrate it with cloud platforms, databases, and notification services without requiring additional plugins. Playbooks in Ansible define the policies your systems under management enforce. They facilitate effective configuration management rather than running ad hoc scripts to deploy complex applications.This book will show you how to write a blueprint of your infrastructure encompassing multi-tier applications using Ansible's playbooks. Beginning with the basic concepts such as plays, tasks, handlers, inventory, and the YAML syntax that Ansible uses, you will see how to organize your code into a modular structure. Building on this, you will master techniques to create data-driven playbooks with variables, templates, logical constructs, and encrypted data. This book will also take you through advanced clustering concepts such as discovering topology information, managing multiple environments, and orchestration.By the end of this book, you will be able to design solutions to your automation and orchestration problems using playbooks quickly and efficiently.Style and approachThis book follows a step-by-step approach, with the concepts explained in a conversational and easy-to-follow style. Each topic is explained sequentially in the process of creating a course. A comprehensive explanation of the basic and advanced features of Ansible playbooks is also included.
  • Englisch
  • Birmingham
  • |
  • Großbritannien
978-1-78439-561-2 (9781784395612)
1784395617 (1784395617)
weitere Ausgaben werden ermittelt
Gourav Shah ( has extensive experience in building and managing highly available, automated, fault-tolerant infrastructure and scaling it. He started his career as a passionate Linux and open source enthusiast, transformed himself into an operations engineer, and evolved to be a cloud and DevOps expert and trainer.
In his previous avatar, Gourav headed IT operations for Efficient Frontier (now Adobe), India. He founded Initcron Systems (, a niche consulting firm that specializes in DevOps enablement and cloud infrastructure management. Under the Initcron banner, he helps companies design DevOps strategies and helps implement them. Initcron also provides automation services for start-ups, as well as large enterprises.
Gourav is a coveted corporate trainer and has trained professionals from top IT companies around the world, such as IBM, CISCO, Qualcomm, Accenture, Dreamworks, Walmart Labs, Intuit, and Wells Fargo, to name a few. He runs a specialized training school by the name School of Devops ( to groom world class cloud and DevOps professionals.
  • Cover
  • Copyright
  • Credits
  • About the Author
  • Acknowledgments
  • About the Reviewers
  • Table of Contents
  • Preface
  • Setting Up the Learning Environment
  • Chapter 1: Blueprinting Your Infrastructure
  • Getting introduced to Ansible
  • Plays
  • YAML - the playbook language
  • Our first playbook
  • Creating a host inventory
  • Patterns
  • Tasks
  • Modules
  • Running the playbook
  • Review questions
  • Summary
  • Chapter 2: Going Modular with Ansible Roles
  • Understanding roles
  • Naming roles
  • The directory layout for roles
  • Creating a site-wide playbook, nesting, and using include statements
  • Creating the www playbook
  • The default and custom role paths
  • Parameterizing the roles
  • Creating a base role
  • Refactoring our code - creating a base role
  • Creating an Nginx role
  • Adding role dependencies
  • Managing files for Nginx
  • Automating events and actions with handlers
  • Adding pre-tasks and post-tasks to playbooks
  • Running playbooks with roles
  • Review questions
  • Summary
  • Chapter 3: Separating Code and Data - Variables, Facts, and Templates
  • Static content explosion
  • Separating code and data
  • Jinja2 templates
  • The template formation
  • Facts and variables
  • Automatic variables - facts
  • User-defined variables
  • Where to define a variable
  • How to define a variable
  • Templating the Nginx configurations
  • Adding another layer - the MySQL role
  • Creating the scaffolding for the roles with Ansible-Galaxy
  • Adding metadata to the role
  • Using variables in tasks and handlers
  • Creating variables
  • Creating tasks
  • Using variables in playbooks
  • Applying a MySQL role to the DB servers
  • Variable precedence
  • The best practices for variable usage
  • Review questions
  • Summary
  • Chapter 4: Bringing In Your Code - Custom Commands and Scripts
  • The command modules
  • Using the raw module
  • Using the command module
  • Using the shell module
  • Using the script module
  • Deploying a WordPress application - a hands-on approach
  • Installing WordPress
  • Controlling the idempotence of command modules
  • The registered variables
  • Extracting WordPress with a shell module
  • Configuring WordPress
  • Review questions
  • Summary
  • Chapter 5: Controlling Execution Flow - Conditionals
  • The conditional control structure
  • The when statements
  • Fact-based selection
  • Refactoring the MySQL role
  • Multilevel variable dictionaries
  • Merging hashes
  • Configuring the MySQL server selectively
  • Conditional control structure in Jinja2 templates
  • Updating the MySQL template
  • Running a task only once
  • Executing roles conditionally
  • Review questions
  • Summary
  • Chapter 6: Iterative Control Structures - Loops
  • The omnipotent with statement
  • Configuring WordPress requisites
  • The PHP5-FPM role
  • Defining an array
  • Looping an array
  • Creating MySQL databases and user accounts
  • Creating a hash
  • Nested hashes
  • Iterating a hash
  • Creating Nginx virtual hosts
  • Defining the PHP site information
  • Review questions
  • Summary
  • Chapter 7: Node Discovery and Clustering
  • Node discovery with magic variables
  • Creating the load balancer role
  • Accessing facts for non-playbook hosts
  • Facts caching with Redis
  • Caching facts in files
  • Review questions
  • Summary
  • Chapter 8: Encrypting Data with Vault
  • The Ansible-vault
  • Advanced Encryption Standard
  • What to encrypt with the vault?
  • Using the Ansible-vault
  • Encrypting the data
  • Updating the encrypted data
  • Rotating the encryption keys
  • Encrypting the database credentials
  • Using a password file
  • Adding the vault password file option to the Ansible configuration
  • Using encrypted data in templates
  • Adding SSL support to Nginx
  • Review questions
  • Summary
  • Chapter 9: Managing Environments
  • Approaches for managing environments
  • The inventory groups and variables
  • Approach 1 - using nested groups in an inventory
  • Approach 2 - using environment-specific inventory variables
  • Creating a development environment
  • Review questions
  • Summary
  • Chapter 10: Orchestrating Infrastructure with Ansible
  • Ansible as an orchestrator
  • Multiple playbooks and ordering
  • Pre-tasks and post-tasks
  • Delegation
  • Rolling updates
  • Tests
  • Tags
  • Patterns and limits
  • Tagging the roles
  • Creating an orchestration playbook for WordPress
  • Review questions
  • Summary
  • References
  • Index

Dateiformat: EPUB
Kopierschutz: Adobe-DRM (Digital Rights Management)


Computer (Windows; MacOS X; Linux): Installieren Sie bereits vor dem Download die kostenlose Software Adobe Digital Editions (siehe E-Book Hilfe).

Tablet/Smartphone (Android; iOS): Installieren Sie bereits vor dem Download die kostenlose App Adobe Digital Editions (siehe E-Book Hilfe).

E-Book-Reader: Bookeen, Kobo, Pocketbook, Sony, Tolino u.v.a.m. (nicht Kindle)

Das Dateiformat EPUB ist sehr gut für Romane und Sachbücher geeignet - also für "fließenden" Text ohne komplexes Layout. Bei E-Readern oder Smartphones passt sich der Zeilen- und Seitenumbruch automatisch den kleinen Displays an. Mit Adobe-DRM wird hier ein "harter" Kopierschutz verwendet. Wenn die notwendigen Voraussetzungen nicht vorliegen, können Sie das E-Book leider nicht öffnen. Daher müssen Sie bereits vor dem Download Ihre Lese-Hardware vorbereiten.

Weitere Informationen finden Sie in unserer E-Book Hilfe.

Download (sofort verfügbar)

24,93 €
inkl. 19% MwSt.
Download / Einzel-Lizenz
ePUB mit Adobe DRM
siehe Systemvoraussetzungen
E-Book bestellen

Unsere Web-Seiten verwenden Cookies. Mit der Nutzung dieser Web-Seiten erklären Sie sich damit einverstanden. Mehr Informationen finden Sie in unserem Datenschutzhinweis. Ok