万本电子书0元读

万本电子书0元读

顶部广告

Ansible Playbook Essentials电子书

售       价:¥

8人正在读 | 0人评论 9.8

作       者:Gourav Shah

出  版  社:Packt Publishing

出版时间:2015-08-05

字       数:66.9万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
If you are a systems or automation engineer who intends to automate common infrastructure tasks, deploy applications, and use orchestration to configure systems in a coordinated manner, then this book is for you. Some understanding of the Linux/Unix command-line interface is expected.
目录展开

Ansible Playbook Essentials

Table of Contents

Ansible Playbook Essentials

Credits

About the Author

Acknowledgments

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

Setting Up the Learning Environment

Understanding the learning environment

Prerequisites

Systems prerequisites

The base software

Creating virtual machines

Installing Ansible on the controller

Using sample code

1. Blueprinting Your Infrastructure

Getting introduced to Ansible

Plays

YAML – the playbook language

Our first playbook

Creating a host inventory

Patterns

Tasks

Modules

The modules and idempotence

Running the playbook

Review questions

Summary

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

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

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

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

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

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

8. Encrypting Data with Vault

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

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

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

A. References

Index

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部