Ansible: Up and Running. Automating Configuration Management and Deployment the Easy Way. 2nd Edition - Helion

ISBN: 978-14-919-7975-4
stron: 430, Format: ebook
Data wydania: 2017-07-20
Księgarnia: Helion
Cena książki: 159,00 zł
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. With this updated second edition, you’ll learn 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.
Authors Lorin Hochstein and René Moser show 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’ll discover that Ansible has the functionality you need—and the simplicity you desire.
- Manage Windows machines, and automate network device configuration
- Manage your fleet from your web browser with Ansible Tower
- Understand how Ansible differs from other configuration management systems
- Use the YAML file format to write your own playbooks
- Work with a complete example to deploy a non-trivial application
- Deploy applications to Amazon EC2 and other cloud platforms
- Create Docker images and deploy Docker containers with Ansible
This book is best read start to finish, with later chapters building on earlier ones. Because it’s written in a tutorial style, you can follow along on your own machine. Most examples focus on web applications.
Osoby które kupowały "Ansible: Up and Running. Automating Configuration Management and Deployment the Easy Way. 2nd Edition", wybierały także:
- The DevOps 2.1 Toolkit: Docker Swarm 332,22 zł, (29,90 zł -91%)
- VMware vSphere 6.7 Data Center Design Cookbook 186,88 zł, (29,90 zł -84%)
- Internet of Things for Architects 186,88 zł, (29,90 zł -84%)
- Microsoft System Center 2016 Orchestrator Cookbook - Second Edition 186,88 zł, (29,90 zł -84%)
- Mastering Active Directory 186,88 zł, (29,90 zł -84%)
Spis treści
Ansible: Up and Running. Automating Configuration Management and Deployment the Easy Way. 2nd Edition eBook -- spis treści
- Foreword
- Preface to the Second Edition
- A Note About Language
- Acknowledgments
- From Lorin
- From René
- Preface to the First Edition
- 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
- 1. Introduction
- A Note About Versions
- Ansible: What Is It Good For?
- How Ansible Works
- Whats 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 Isnt 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
- 2. Playbooks: A Beginning
- Some Preliminaries
- A Very Simple Playbook
- Specifying an Nginx Config File
- Creating a Custom Home Page
- 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 a TLS Certificate
- Variables
- Generating the Nginx Configuration Template
- Handlers
- A few things to keep in mind about handlers
- Running the Playbook
- 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
- Showing host details
- Listing groups
- Writing a Dynamic Inventory Script
- Preexisting Inventory Scripts
- The Interface for a Dynamic Inventory Script
- Breaking the Inventory into Multiple Files
- Adding Entries at Runtime with add_host and group_by
- add_host
- group_by
- 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
- 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
- Why Deploying to Production Is Complicated
- 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 Become Clause to a Task
- Updating the Apt Cache
- Checking Out the Project by Using Git
- Installing Mezzanine and Other Packages into a virtualenv
- Complex Arguments in Tasks: A Brief Digression
- Configuring the Database
- 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
- Troubleshooting
- Cannot Check Out Git Repository
- Cannot Reach 192.168.33.10.xip.io
- Bad Request (400)
- Deploying Mezzanine on Multiple Machines
- 7. 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
- Installing a role
- Listing installed roles
- Uninstalling a role
- Contributing Your Own Role
- 8. Complex Playbooks
- Dealing with Badly Behaved Commands: changed_when and failed_when
- 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 Plugin
- More Complicated Loops
- with_lines
- with_fileglob
- with_dict
- Looping Constructs as Lookup Plugins
- Loop Controls
- Setting the Variable Name
- Labeling the Output
- Includes
- Dynamic Includes
- Role Includes
- Blocks
- Error Handling with Blocks
- Encrypting Sensitive Data with Vault
- 9. Customizing Hosts, Runs, and Handlers
- Patterns for Specifying Hosts
- Limiting Which Hosts Run
- Running a Task on the Control Machine
- Running a Task on a Machine Other Than the Host
- Running on One Host at a Time
- Running on a Batch of Hosts at a Time
- Running Only Once
- Running Strategies
- Linear
- Free
- Advanced Handlers
- Handlers in Pre and Post Tasks
- Flush Handlers
- Handlers Listen
- Handlers listen: The SSL case
- Manually Gathering Facts
- Retrieving the IP Address from the Host
- 10. Callback Plugins
- Stdout Plugins
- actionable
- debug
- dense
- json
- minimal
- oneline
- selective
- skippy
- Other Plugins
- foreman
- hipchat
- jabber
- junit
- log_plays
- logentries
- logstash
- osx_say
- profile_tasks
- slack
- timer
- Stdout Plugins
- 11. 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
- Concurrent Tasks with Async
- SSH Multiplexing and ControlPersist
- 12. 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 that Ansible Expects
- changed
- failed
- msg
- Output Variables that Ansible Expects
- Implementing Modules in Python
- Parsing Arguments
- Accessing Parameters
- Importing the AnsibleModule Helper Class
- Argument Options
- required
- default
- choices
- aliases
- type
- AnsibleModule Initializer Parameters
- argument_spec
- no_log
- check_invalid_arguments
- mutually_exclusive
- required_one_of
- add_file_common_args
- bypass_checks
- Returning Success or Failure
- Invoking External Commands
- Check Mode (Dry Run)
- Documenting Your Module
- Debugging Your Module
- Implementing the Module in Bash
- Specifying an Alternative Location for Bash
- Example Modules
- 13. 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
- Ansible Local Provisioner
- Convenient Vagrant Configuration Options
- 14. Amazon EC2
- Terminology
- Instance
- Amazon Machine Image
- Tags
- Specifying Credentials
- Environment Variables
- Configuration Files
- Prerequisite: Boto Python Library
- Dynamic Inventory
- Inventory Caching
- Other Configuration Options
- Autogenerated Groups
- Defining Dynamic Groups with Tags
- Applying Tags to Existing Resources
- Nicer Group Names
- EC2 Virtual Private Cloud and EC2 Classic
- Configuring ansible.cfg for Use with ec2
- Launching New Instances
- EC2 Key Pairs
- Creating a New Key
- Uploading 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
- Putting It All Together
- Specifying a Virtual Private Cloud
- Dynamic Inventory and VPC
- Building AMIs
- With the ec2_ami Module
- With Packer
- Ansible Remote Provisioner
- Ansible Local Provisioner
- Other Modules
- Terminology
- 15. Docker
- The Case for Pairing Docker with Ansible
- Docker Application Life Cycle
- Example Application: Ghost
- Connecting to the Docker Daemon
- Running a Container on Our Local Machine
- Building an Image from a Dockerfile
- Orchestrating Multiple Containers on Our Local Machine
- Pushing Our Image to the Docker Registry
- Querying Local Images
- Deploying the Dockerized Application
- Backend: Postgres
- Frontend
- Frontend: Ghost
- Frontend: Nginx
- Cleaning Out Containers
- Connecting Directly to Containers
- Ansible Container
- The Conductor
- Creating Docker Images
- Creating the initial files
- Creating the roles
- Configuring container.yml
- Building the containers
- Troubleshooting builds
- Running Locally
- Publishing Images to Registries
- Authenticating
- Multiple registries
- Deploying Containers to Production
- 16. Debugging Ansible Playbooks
- Humane Error Messages
- Debugging SSH Issues
- The Debug Module
- Playbook Debugger
- 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
- Tags
- 17. Managing Windows Hosts
- Connection to Windows
- PowerShell
- Windows Modules
- Our First Playbook
- Updating Windows
- Adding Local Users
- Conclusion
- 18. Ansible for Network Devices
- Status of Network Modules
- List of Network Vendors Supported
- Preparing Our Network Device
- Enable SSH Authentication
- How the Modules Work
- Our First Playbook
- Inventory and Variables for Network Modules
- Local Connection
- Host Connection
- Authentication Variables
- Save the Config
- Use Configs from a File
- Templates, Templates, Templates
- Gathering Facts
- Conclusion
- 19. Ansible Tower: Ansible for the Enterprise
- Subscription Models
- Try Ansible Tower
- What Ansible Tower Solves
- Access Control
- Projects
- Inventory Management
- Run Jobs by Job Templates
- RESTful API
- Ansible Tower CLI
- Installation
- Create a User
- Launch a Job
- Onward
- Subscription Models
- A. SSH
- Native SSH
- SSH Agent
- Starting Up ssh-agent
- macOS
- Linux
- Agent Forwarding
- Sudo and Agent Forwarding
- Host Keys
- B. Using IAM Roles for EC2 Credentials
- AWS Management Console
- Command-Line
- Glossary
- Bibliography
- Index





