Following a look inside Ansible 2.0 and Ansible Tower 2.2, the open-source community took the lead at AnsibleFest NYC in presentations showing how the versatile technology works in tandem with popular platforms such as Docker and OpenStack.
In a presentation entitled “Operating Your OpenStack Cloud Using Ansible,” Rackspace cloud solutions architect Walter Bentley explained why, to him, “The combination of OpenStack and Ansible just feels right.”
He explained that putting Ansible and OpenStack together makes sense because due to existing Ansible modules for Linux management and OpenStack, working with Ansible on OpenStack is essentially like working with a Linux kernel. Ansible playbooks can be written against APIs or Python CLIs, he said, and only Python and SSH are required on the target device or environment, with no clients or agents needed to set up administrative functions.
“With an OpenStack cloud, it’s fully distributed; it’s x number of machines you have to chase down on cloud or virtual or bare metal servers,” said Bentley. “Designing roles with unique variable values is as easy as writing an e-mail.”
Bentley proved his point by inviting an AnsibleFest attendee onstage to perform some live tasks in OpenStack in an Ansible version of “The Price is Right.”
Building a Docker-ized microservice in Node using Ansible
In another presentation, Irakli Nadareishvili, director of strategy for CA Technologies’ API Academy, explained why Ansible in conjunction with HashiCorp’s open-source Consul monitoring and configuration tool is a great way to orchestrate microservices and Docker containers.
He described microservice architecture as a style where a complex system is decomposed into a collection of autonomous, independently deployable services that are small, easily replaceable, and able to deliver one distinct capability. The problem in what he referred to as a “decoupled jungle” is knowing where each of these microservices is and what it’s doing.
“With microservices, your operations maturity must be at a certain level for you not to hurt yourself. You need to have full automation,” said Nadareishvili.
While he presented several options used by CA for keeping track of these containerized microservices—CoreOS, Kubernetes, Apache Mesos and Apache ZooKeeper—Nadareishvili demonstrated why he believes it works best by using Ansible and Consul.
During the demo, Nadareishvili set up both a server cluster and clients with Consul, provisioned a Docker Host (which he called a Tanker), and installed a Node.js microservice from Docker.io. Once deployed on the Docker Host, Ansible built the fully functioning microservice live onstage in less than half an hour.
The one limitation is the ability to use Ansible inside the containers themselves. Nadareishvili said there’s a great opportunity for Ansible and Docker to work together to improve that aspect of the process.
“I think it’s something Ansible and the container community can really collaborate on,” he said. “What we do now is build Docker images using Docker files or Docker Compose, but the same text of Docker files is not nearly as robust or reliable as the Ansible syntax.”
Nadareishvili’s demo is available on GitHub.
Ansible tips and tricks
Ansible director of engineering Brian Coca rounded out the day with a presentation running down the ways Ansible can be used as a veritable Swiss Army Knife of programming.
“Ansible can do almost every job if you put it to it,” he said. “Ansible started out as a Unix tool, even though now it’s used on Windows or as a framework or API. It just runs a task on a host. It’s simple but an incredibly powerful paradigm.”
Coca demonstrated coding workarounds and scripts he’s used to leverage Ansible as a Unix tool, as well as a shell script, an automation framework, a QA and testing script, an automated e-mail blaster, a distributed batch executor, an ad hoc security scheme, and as a programming language itself.
The code and methodology behind each one of Coca’s Ansible tips and tricks is available in his presentation slides from the show.