Description
Book SynopsisLearn the concepts and develop the skills to be a true Ansible artist and use it inside and outside the box. This book applies key concepts immediately while building up your Ansible skills layer by layer through easy to grasp examples and engaging projects. You'll also think about security, why testing is important, and how to use version control safely. As a beginner to Ansible, you'll be guided step-by-step through creating your first Ansible playbook to deploying your first server and writing more complex cross-dependency playbooks. From the first line of code to the last, you'll constantly iterate and simplify your playbooks, iwhile taking on more complex topics as you construct a full Wordpress website stack consisting of a database, web servers, and load balancer. This book will prompt you to think about how these fit together and will explain what to do to ensure maintainability long into the future. Don't just use Ansible. Completely change how you go about provisioning, con
Table of ContentsChapter 1 – Setting the Scene
Foundations of Ansibl
Create an environment
Challenges to come
Chapter 2 – Say Hello to Ansible
Introduce Ansible
History
Tools
Chapter 3 – Getting Ansible and Setting Up the Environment
Download and set up Ansible
Using virtual python environments
Using VirtualBox
Chapter 4 – Your First Steps with Ansible
Play with Ansible
Revision control and security aspects
Python 2 vs 3
Chapter 5 – Run Your First playbook
Create and run your first playbook
Structure of a playbook
Put servers under source control
Chapter 6 – Designing an Inventory
Using localhost
Inventories
Chapter 7 – Setting Your Sights – Target the Servers You Want
Setting up real servers
Playbook skills and inventory skills
Writing the playbook
Chapter 8 – Batteries Included – The Core Modules
Core modules
Installing packages, copying config files, and making changes to system config
Web based documentation
Chapter 9 – Gathering Data and the Power of Facts
Using fact gathering
Automatic (implicit) fact-gathering for every playbook
Explicit fact gathering
Stat to gain information on files, directories, and symbolic links
Chapter 10 – The Building Blocks of Ansible – Roles
Chapter 11 – Making Decisions and Controlling Flow
Conditionals
Options
includes and when clauses
Chapter 12 – Repeating Yourself
Loops
Syntax
Chapter 13 – Jinja 2 and the Power of Templates
Chapter 14 – Structuring Your Repo for Success
Basic directory structure
Organize groups of variables, vaults, roles, and tasks to ensure your playbooks are scalable
Chapter 15 – Locking Away Your Secrets
Ansible-vaults
Environment specific encrypted stores
Chapter 16 – Extending the Power of Ansible
Creation of custom modules
Module types (actions, filters, callback to name a few)
Hints and tips on when a plugin is the right course of action
Chapter 17 – Dynamically Generating Your Inventory
Inventory, or CMDB
Inventory source
Simple web service to pull in the ansible inventory at runtime
Meta groups
Chapter 18 – Community
Share playbooks with like-minded sysadmins
Ansible Galaxy
Chapter 19 - Troubleshooting Ansible
Chapter 20 – Other Projects Around AnsiblePOSSIBLE: document interesting projects that make use of Ansible's power, such as ansible-cmdb