You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Jeff Geerling a531ef1d8f Issue #393: Make sure Ansible is installed for molecule tests. 1 month ago
.github Issue #393: Make sure Ansible is installed for molecule tests. 1 month ago
collection Issue #202: Local collections don't require config to be picked up. 10 months ago
deployments Fixes #259: Update Rails deployment demo Vagrantfile for better WSL compatibility. 9 months ago
deployments-balancer Fixes #239: Rework HAProxy balancer example and make sure apt cache is updated. 9 months ago
deployments-rolling Fixes #298: Change usage of 'src' in requirements.yml files. 9 months ago
docker Issue #310: Fix link to Docker Flask app example. [ci skip] 9 months ago
docker-flask Fixes #298: Change usage of 'src' in requirements.yml files. 9 months ago
docker-hubot Fixes #165: Fix lingering deprecation warnings in some examples. 2 years ago
drupal Issue #308: Remove unused variables. 9 months ago
dynamic-inventory Fixes #303: Update 'Dynamic inventory with AWS' example to use aws_ec2 plugin. 9 months ago
elk Bump Elasticsearch role requirement version. 7 months ago
first-ansible-playbook Fix capitalization for chrony 9 months ago
galaxy-role-servers Fixes #187: Add galaxy role-based servers for lamp and solr. 9 months ago
gluster Fixes #298: Change usage of 'src' in requirements.yml files. 9 months ago
https-letsencrypt Fixes #93: Assume Python 3 is available on Ubuntu 20.04. 9 months ago
https-nginx-proxy Fixes #298: Change usage of 'src' in requirements.yml files. 9 months ago
https-self-signed Fixes #298: Change usage of 'src' in requirements.yml files. 9 months ago
includes Issue #295: Even more fixes for Ubuntu 20.04 compatibility. 9 months ago
jenkins Fixes #298: Change usage of 'src' in requirements.yml files. 9 months ago
kubernetes Fixes #249: Update Helm example in chapter 16. 9 months ago
lamp-infrastructure Fixes #303: Update 'Dynamic inventory with AWS' example to use aws_ec2 plugin. 9 months ago
molecule Fixes #314: Explicitly define 'mode' for web page molecule example. 8 months ago
nodejs Issue #295: Update memory allocation for VMs. 9 months ago
nodejs-role Issue #295: Update memory allocation for VMs. 9 months ago
orchestration Fixes #221: Final tweaks to orchestration testing. 9 months ago
security Final tweaks to security test configuration. 9 months ago
solr Issue #307: Update Apache Solr example in Chapter 4 to latest 8.6.0 version. 9 months ago
test-plugin Issue #202: More idiomatic Ansible Python style. 10 months ago
tests Fix broken test build due to molecule docker dependency missing. 6 months ago
.gitignore Fixes #249: Update Helm example in chapter 16. 9 months ago
LICENSE Issue #5: Add MIT License. 6 years ago
README.md Fix the grammar 1 month ago

README.md

Ansible for DevOps Examples

CI Molecule CI

This repository contains Ansible examples developed to support different sections of Ansible for DevOps, a book on Ansible by Jeff Geerling.

Most of the examples are full-fledged VM examples, which use Vagrant, VirtualBox, and Ansible to boot and configure VMs on your local workstation. Not all playbooks follow all of Ansible's best practices, as they illustrate particular Ansible features in an instructive manner.

For more interesting examples of what you can do with Ansible, please see the Ansible Vagrant Examples repository, and browse through some of geerlingguy's roles on Ansible Galaxy.

Examples and Chapters in which they're used

Here is an outline of all the examples contained in this repository, by chapter:

Chapter 1

  • N/A

Chapter 2

Chapter 3

  • orchestration: A simple multiple-VM Vagrant configuration and Ansible inventory to allow testing of multi-server orchestration with ansible ad-hoc commands.

Chapter 4

  • drupal: A single-file playbook which configures the LAMP stack on a Linux host and installs Drupal.
  • includes: The same playbook as the drupal example, but using includes to make the playbook more understandable.
  • nodejs: A single-file playbook which configures a Node.js app to run on a Linux host.
  • solr: A single-file playbook which installs Apache Solr on a Linux host.

Chapter 5

  • N/A

Chapter 6

  • nodejs-role: The same playbook as the nodejs example, but using a role to break out the Node.js aspects into a separate nodejs role.
  • galaxy-role-servers: A couple very short playbooks that demonstrate how easy it is to get new servers running leveraging the power of community Ansible Galaxy roles.

Chapter 7

  • test-plugin: A simple test plugin that verifies a given value is representative of the color blue.
  • collection: An example local collection to demonstrate the basic structure of content collections.

Chapter 8

  • dynamic-inventory: Two example dynamic inventory scripts (one in PHP, one in Python) for use with Ansible.

Chapter 9

  • lamp-infrastructure: A multi-server LAMP-based web application infrastructure focused on high-availability and performance for a LAMP-stack app.
  • elk: A two-server example of the Elasticsearch-Logstash-Kibana stack, which uses one server to store and visualize logs centrally, and another server to send logs via Filebeat.
  • gluster: A two-server example of building a fast networked storage setup using Gluster.

Chapter 10

  • deployments: A playbook that deploys a Ruby on Rails application into an environment that runs Passenger and Nginx to handle web requests.
  • deployments-balancer: A playbook that handles zero-downtime deployments to webservers running behind an HAProxy load balancer.
  • deployments-rolling: A playbook that demonstrates rolling deployments to multiple servers for a Node.js app.

Chapter 11

  • security: A playbook containing many security automation tasks to demonstrate how Ansible helps automate security hardening.

Chapter 12

  • jenkins: A playbook that installs and configures Jenkins for CI/CD.

Chapter 13

  • molecule: A Molecule example used for testing and developing an Ansible playbook, or for testing in a Continuous Integration (CI) environment.
  • molecule-ci.yml GitHub Actions workflow: A GitHub Actions workflow which runs the molecule example in a CI environment.

Chapter 14

  • https-self-signed: A playbook that generates self-signed certificates.
  • https-letsencrypt: A playbook that demonstrates automated certificate management with Let's Encrypt and Ansible.
  • https-nginx-proxy: A playbook that demonstrates proxying HTTPS traffic through Nginx to HTTP backends.

Chapter 15

  • docker: Very simple playbook demonstrating Ansible's ability to manage Docker container images.
  • docker-hubot: Slightly more involved example of Ansible's ability to manage and run Docker container images.
  • docker-flask: A sample Flask app built with Ansible playbooks running inside the container.

Chapter 16

  • kubernetes: A playbook that builds a three-node Kubernetes cluster.

License

MIT

Sponsors

  • TinyPilot: An open-source, low-cost KVM over IP for managing your servers.
  • Tugboat: Tugboat is the fastest data-first ephemeral environment CI/CD tool. And here's a tub goat to prove it: 🛁🐐

The above sponsor(s) are supporting Jeff Geerling on GitHub Sponsors. You can sponsor Jeff's work too, to help him continue improving this book and Ansible open source work!

Buy the Book

Ansible for DevOps Cover

Buy Ansible for DevOps for your e-reader or in paperback format.