Mastering Ansible
eBook - ePub

Mastering Ansible

Jesse Keating

Condividi libro
  1. 236 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Mastering Ansible

Jesse Keating

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

Design, develop, and solve real world automation and orchestration needs by unlocking the automation capabilities of Ansible

About This Book

  • Discover how Ansible works in detail
  • Explore use cases for Ansible's advanced features including task delegation, fast failures, and serial task execution
  • Extend Ansible with custom modules, plugins, and inventory sources

Who This Book Is For

This book is intended for Ansible developers and operators who have an understanding of the core elements and applications but are now looking to enhance their skills in applying automation using Ansible.

What You Will Learn

  • Understand Ansible's code and logic flow
  • Safeguard sensitive data within Ansible
  • Access and manipulate complex variable data within Ansible playbooks
  • Handle task results to manipulate change and failure definitions
  • Organize Ansible content into a simple structure
  • Craft a multi-tier rollout playbook utilizing load balancers and manipulating your monitoring system
  • Utilize advanced Ansible features to orchestrate rolling updates with almost no service disruptions
  • Troubleshoot Ansible failures to understand and resolve issues
  • Extend Ansible with custom modules, plugins, or inventory sources

In Detail

Automation is critical to success in the world of DevOps. How quickly and efficiently an application deployment can be automated, or a new infrastructure can be built up, can be the difference between a successful product or a failure. Ansible provides a simple yet powerful automation engine. Beyond the basics of Ansible lie a host of advanced features which are available to help you increase efficiency and accomplish complex orchestrations with ease.

This book provides you with the knowledge you need to understand how Ansible works at a fundamental level and leverage its advanced capabilities. You'll learn how to encrypt Ansible content at rest and decrypt data at runtime. You will master the advanced features and capabilities required to tackle the complex automation challenges of today and beyond. You will gain detailed knowledge of Ansible workflows, explore use cases for advanced features, craft well thought out orchestrations, troubleshoot unexpected behaviour, and extend Ansible through customizations. Finally, you will discover the methods used to examine and debug Ansible operations, helping you to understand and resolve issues.

Style and approach

A clear, practical guide that covers best practise, system architecture and design aspects that will help you master Ansible with ease.

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Mastering Ansible è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Mastering Ansible di Jesse Keating in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Computer Science e Application Development. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
2015
ISBN
9781784395483

Mastering Ansible


Table of Contents

Mastering Ansible
Credits
About the Author
Acknowledgment
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. System Architecture and Design of Ansible
Ansible version and configuration
Inventory parsing and data sources
The static inventory
Inventory variable data
Dynamic inventories
Run-time inventory additions
Inventory limiting
Playbook parsing
Order of operations
Relative path assumptions
Play behavior keys
Host selection for plays and tasks
Play and task names
Module transport and execution
Module reference
Module arguments
Module transport and execution
Task performance
Variable types and location
Variable types
Accessing external data
Variable precedence
Precedence order
Extra-vars
Connection variables
Most everything else
The rest of the inventory variables
Facts discovered about a system
Role defaults
Merging hashes
Summary
2. Protecting Your Secrets with Ansible
Encrypting data at rest
Things Vault can encrypt
Creating new encrypted files
The password prompt
The password file
The password script
Encrypting existing files
Editing encrypted files
Password rotation for encrypted files
Decrypting encrypted files
Executing ansible-playbook with Vault-encrypted files
Protecting secrets while operating
Secrets transmitted to remote hosts
Secrets logged to remote or local files
Summary
3. Unlocking the Power of Jinja2 Templates
Control structures
Conditionals
Inline conditionals
Loops
Filtering loop items
Loop indexing
Macros
Macro variables
name
arguments
defaults
catch_kwargs
catch_varargs
caller
Data manipulation
Syntax
Useful built-in filters
default
count
random
round
Useful Ansible provided custom filters
Filters related to task status
shuffle
Filters dealing with path names
basename
dirname
expanduser
Base64 encoding
Searching for content
Omitting undefined arguments
Python object methods
String methods
List methods
int and float methods
Comparing values
Comparisons
Logic
Tests
Summary
4. Controlling Task Conditions
Defining a failure
Ignoring errors
Defining an error condition
Defining a change
Special handling of the command family
Suppressing a change
Summary
5. Composing Reusable Ansible Content with Roles
Task, handler, variable, and playbook include concepts
Including tasks
Passing variable values to included tasks
Passing complex data to included tasks
Conditional task includes
Tagging included tasks
Including handlers
Including variables
vars_files
Dynamic vars_files inclusion
include_vars
extra-vars
Including playbooks
Roles
Role structure
Tasks
Handlers
Variables
Modules
Dependencies
Files and templates
Putting it all together
Role dependencies
Role dependency variables
Tags
Role dependency conditionals
Role application
Mixing roles and tasks
Role sharing
Ansible Galaxy
Summary
6. Minimizing Downtime with Rolling Deployments
In-place upgrades
Expanding and contracting
Failing fast
The any_errors_fatal option
The max_fail_percentage option
Forcing handlers
Minimizing disruptions
Delaying a disruption
Running destructive tasks only once
Summary
7. Troubleshooting Ansible
Playbook logging and verbosity
Verbosity
Logging
Variable introspection
Variable sub elements
Subelement versus Python object method
Debugging code execution
Debugging local code
Debugging inventory code
Debugging Playbook code
Debugging runner code
Debugging remote code
Debugging the action plugins
Summary
8. Extending Ansible
Developing modules
The basic module construct
Custom modules
Simple module
Module documentation
Providing fact data
Check mode
Supporting check mode
Handling check mode
Developing plugins
Connection type plugins
Shell plugins
Lookup plugins
Vars plugins
Fact caching plugins
Filter plugins
Callback plugins
Action plugins
Distributing plugins
Developing dynamic inventory plugins
Listing hosts
Listing host variables
Simple inventory plugin
Optimizing script performance
Summary
Index

Mastering Ansible

Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authornor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: November 2015
Production reference:1191115
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B32PB, UK.
ISBN 978-1-78439-548-3
www.packtpub.com

Credits

Author
Jesse Keating
Reviewers
Ryan Eschinger
Sreenivas Makam
Tim Rupp
Sawant Shah
Patrik Uytterhoeven
Acquisition Editor
Meeta Rajani
Content Development Editor
Zeeyan Pinheiro
Technical Editor
Rohan Uttam Gosavi
Copy Editor
Pranjali Chury
Project Coordinator
Nidhi Joshi
Proofreader
Safis Editing
Indexer
Monica Ajmera Mehta
Graphics
Disha Haria
Production Coordinator
Arvindkumar Gupta
Cover Work
Arvindkumar Gupta

About the Author

Jesse Keating is an accompl...

Indice dei contenuti