Getting output from Docker containers from within Ansible

Reading Time: Approximately 1 minutes.

The Problem

You want to use Ansible’s docker_container module to do stuff, but want to also perform actions based on their output without specifying a logging driver or writing to a temp file.

The Solution

Do this:

»

Provisioning VMware Workstation Machines from Artifactory with Vagrant

Reading Time: Approximately 1 minutes.

I wrote a small Vagrantfile and helper library for provisioning VMware VMs from boxes hosted on Artifactory. I put this together with the intent of helping us easily provision our Rancher/Cattle/Docker-based platform wholesale on our machines to test changes before pushing them up.

Here it is: https://github.com/carlosonunez/vagrant_vmware_artifactory_example

Tests are to be added soon! I’m thinking Cucumber integration tests with unit tests on the helper methods and Vagrantfile correctness.

»

Winning at Ansible: How to manipulate items in a list!

Reading Time: Approximately 3 minutes.

The Problem

Ansible is a great configuration management platform with a very, very extensible language for expressing yoru infrastructure as code. It works really well for common workflows (deploying files, adding authorized_keys, creating new EC2 instances, etc), but its limitations become readily apparent as you begin embarking in more custom and complex plays.

Here’s a quick example. Let’s say you have a playbook that uses a variable (or var in Ansible-speak) that contains a list of tables, like this:

»