My Account Log in

1 option

Ansible : Up and Running

O'Reilly Online Learning: Academic/Public Library Edition Available online

View online
Format:
Book
Author/Creator:
Hochstein, Lorin.
Language:
English
Subjects (All):
Ansible (Computer program language).
Physical Description:
1 online resource (332 p.)
Edition:
Preview ed.
Place of Publication:
Sebastopol, California : O'Reilly Media, 2015.
Language Note:
English
System Details:
text file
Summary:
Among the many configuration management tools available, Ansible has some distinct advantages-it's minimal in nature, you don't need to install anything on your nodes, and it has an easy learning curve. This practical guide shows you how to be productive with this tool quickly, whether you're a developer deploying code to production or a system administrator looking for a better automation solution. Author Lorin Hochstein shows you how to write playbooks (Ansible's configuration management scripts), manage remote servers, and explore the tool's real power: built-in declarative modules. You'l
Contents:
Intro
Copyright
Table of Contents
Foreword
Preface
Why I Wrote This Book
Who Should Read This Book
Navigating This Book
Conventions Used in This Book
Online Resources
Safari® Books Online
How to Contact Us
Acknowledgments
Chapter 1. Introduction
A Note About Versions
Ansible: What Is It Good For?
How Ansible Works
What's So Great About Ansible?
Easy-to-Read Syntax
Nothing to Install on the Remote Hosts
Push-Based
Ansible Scales Down
Built-in Modules
Very Thin Layer of Abstraction
Is Ansible Too Simple?
What Do I Need to Know?
What Isn't Covered
Installing Ansible
Setting Up a Server for Testing
Using Vagrant to Set Up a Test Server
Telling Ansible About Your Test Server
Simplifying with the ansible.cfg File
Moving Forward
Chapter 2. Playbooks: A Beginning
Some Preliminaries
A Very Simple Playbook
Specifying an nginx Config File
Creating a Custom Homepage
Creating a Webservers Group
Running the Playbook
Playbooks Are YAML
Start of File
Comments
Strings
Booleans
Lists
Dictionaries
Line Folding
Anatomy of a Playbook
Plays
Tasks
Modules
Putting It All Together
Did Anything Change? Tracking Host State
Getting Fancier: TLS Support
Generating TLS certificate
Variables
Generating the Nginx Configuration Template
Handlers
Chapter 3. Inventory: Describing Your Servers
The Inventory File
Preliminaries: Multiple Vagrant Machines
Behavioral Inventory Parameters
ansible_connection
ansible_shell_type
ansible_python_interpreter
ansible_*_interpreter
Changing Behavioral Parameter Defaults
Groups and Groups and Groups
Example: Deploying a Django App
Aliases and Ports
Groups of Groups
Numbered Hosts (Pets versus Cattle).
Hosts and Group Variables: Inside the Inventory
Host and Group Variables: In Their Own Files
Dynamic Inventory
The Interface for a Dynamic Inventory Script
Writing a Dynamic Inventory Script
Pre-Existing Inventory Scripts
Breaking Out the Inventory into Multiple Files
Adding Entries at Runtime with add_host and group_by
add_host
group_by
Chapter 4. Variables and Facts
Defining Variables in Playbooks
Viewing the Values of Variables
Registering Variables
Facts
Viewing All Facts Associated with a Server
Viewing a Subset of Facts
Any Module Can Return Facts
Local Facts
Using set_fact to Define a New Variable
Built-in Variables
hostvars
inventory_hostname
Groups
Setting Variables on the Command Line
Precedence
Chapter 5. Introducing Mezzanine: Our Test Application
Why Deploying to Production Is Complicated
PostgreSQL: The Database
Gunicorn: The Application Server
Nginx: The Web Server
Supervisor: The Process Manager
Chapter 6. Deploying Mezzanine with Ansible
Listing Tasks in a Playbook
Organization of Deployed Files
Variables and Secret Variables
Using Iteration (with_items) to Install Multiple Packages
Adding the Sudo Clause to a Task
Updating the Apt Cache
Checking Out the Project Using Git
Installing Mezzanine and Other Packages into a virtualenv
Complex Arguments in Tasks: A Brief Digression
Creating the Database and Database User
Generating the local_settings.py File from a Template
Running django-manage Commands
Running Custom Python Scripts in the Context of the Application
Setting Service Configuration Files
Enabling the Nginx Configuration
Installing TLS Certificates
Installing Twitter Cron Job
The Full Playbook
Running the Playbook Against a Vagrant Machine.
Deploying Mezzanine on Multiple Machines
Chapter 7. Complex Playbooks
Running a Task on the Control Machine
Running a Task on a Machine Other Than the Host
Manually Gathering Facts
Running on One Host at a Time
Running Only Once
Dealing with Badly Behaved Commands: changed_when and failed_when
Retrieving the IP Address from the Host
Encrypting Sensitive Data with Vault
Patterns for Specifying Hosts
Limiting Which Hosts Run
Filters
The Default Filter
Filters for Registered Variables
Filters That Apply to File Paths
Writing Your Own Filter
Lookups
file
pipe
env
password
template
csvfile
dnstxt
redis_kv
etcd
Writing Your Own Lookup Plug-in
More Complicated Loops
with_lines
with_fileglob
with_dict
Looping Constructs as Lookup Plug-ins
Chapter 8. Roles: Scaling Up Your Playbooks
Basic Structure of a Role
Example: Database and Mezzanine Roles
Using Roles in Your Playbooks
Pre-Tasks and Post-Tasks
A "Database" Role for Deploying the Database
A "Mezzanine" Role for Deploying Mezzanine
Creating Role Files and Directories with ansible-galaxy
Dependent Roles
Ansible Galaxy
Web Interface
Command-Line Interface
Contributing Your Own Role
Chapter 9. Making Ansible Go Even Faster
SSH Multiplexing and ControlPersist
Manually Enabling SSH Multiplexing
SSH Multiplexing Options in Ansible
Pipelining
Enabling Pipelining
Configuring Hosts for Pipelining
Fact Caching
JSON File Fact-Caching Backend
Redis Fact Caching Backend
Memcached Fact Caching Backend
Parallelism
Accelerated Mode
Fireball Mode
Chapter 10. Custom Modules
Example: Checking That We Can Reach a Remote Server
Using the Script Module Instead of Writing Your Own
can_reach as a Module
Where to Put Custom Modules.
How Ansible Invokes Modules
Generate a Standalone Python Script with the Arguments (Python Only)
Copy the Module to the Host
Create an Arguments File on the Host (Non-Python Only)
Invoke the Module
Expected Outputs
Output Variables Ansible Expects
Implementing Modules in Python
Parsing Arguments
Accessing Parameters
Importing the AnsibleModule Helper Class
Argument Options
AnsibleModule Initializer Parameters
Returning Success or Failure
Invoking External Commands
Check Mode (Dry Run)
Documenting Your Module
Debugging Your Module
Implementing the Module in Bash
Specifying an Alternaive Location for Bash
Example Modules
Chapter 11. Vagrant
Convenient Vagrant Configuration Options
Port Forwarding and Private IP Addresses
Enabling Agent Forwarding
The Ansible Provisioner
When the Provisioner Runs
Inventory Generated by Vagrant
Provisioning in Parallel
Specifying Groups
Chapter 12. Amazon EC2
Terminology
Instance
Amazon Machine Image
Tags
Specifying Credentials
Environment Variables
Configuration Files
Prerequisite: Boto Python Library
Inventory Caching
Other Configuration Options
Auto-Generated Groups
Defining Dynamic Groups with Tags
Applying Tags to Existing Resources
Nicer Group Names
EC2 Virtual Private Cloud (VPC) and EC2 Classic
Configuring ansible.cfg for Use with ec2
Launching New Instances
EC2 Key Pairs
Creating a New Key
Upload an Existing Key
Security Groups
Permitted IP Addresses
Security Group Ports
Getting the Latest AMI
Adding a New Instance to a Group
Waiting for the Server to Come Up
Creating Instances the Idempotent Way
Specifying a Virtual Private Cloud
Dynamic Inventory and VPC
Building AMIs.
With the ec2_ami Module
With Packer
Other Modules
Chapter 13. Docker
The Case for Pairing Docker with Ansible
Docker Application Life Cycle
Dockerizing Our Mezzanine Application
Creating Docker Images with Ansible
Mezzanine
The Other Container Images
Postgres
Memcached
Nginx
Certs
Building the Images
Deploying the Dockerized Application
Starting the Database Container
Retrieving the Database Container IP Address and Mapped Port
Waiting for the Database to Start Up
Initializing the Database
Starting the Memcached Container
Starting the Mezzanine Container
Starting the Certificate Container
Starting the Nginx Container
The Entire Playbook
Chapter 14. Debugging Ansible Playbooks
Debugging SSH Issues
The Debug Module
The Assert Module
Checking Your Playbook Before Execution
Syntax Check
List Hosts
List Tasks
Check Mode
Diff (Show File Changes)
Limiting Which Tasks Run
Step
Start-at-Task
Onward
Appendix A. SSH
Native SSH
SSH Agent
Starting Up ssh-agent
Mac OS X
Linux
Agent Forwarding
Sudo and Agent Forwarding
Host Keys
Appendix B. Default Settings
Appendix C. Using IAM Roles for EC2 Credentials
AWS Management Console
Command-Line
Glossary
Bibliography
Index
About the Author.
Notes:
Description based upon print version of record.
Includes bibliographical references and index.
Description based on publisher supplied metadata and other sources.
ISBN:
9781491915318
1491915315
9781491915325
1491915323
OCLC:
1024238861

The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.

Find

Home Release notes

My Account

Shelf Request an item Bookmarks Fines and fees Settings

Guides

Using the Find catalog Using Articles+ Using your account