Avatar (Fabio Alessandro Locati|Fale)'s blog

Ansible Tower in Vagrant

July 26, 2017

A lot of times during my job I found myself with the need of Ansible Tower testing environments.

In the last few weeks I created a Vagrant script to actually automate it.

As this is a single host installation, which is usually more than enough for the majority of tests I do, the Vagrant file is very easy:

Vagrant.configure(2) do |config|

    # Set machine size
    config.vm.provider :libvirt do |domain|
        domain.memory = 2048
        domain.cpus = 1
    end

    # Tower/PgSQL machine
    config.vm.define "tower" do |tower|
        tower.vm.box = "centos/7"
    end

    # Ansible Tower configuration
    config.vm.provision "ansible" do |ansible|
        ansible.playbook = "playbook.yaml"
    end

end

I basically create a 2Gb of RAM machine leveraging libvirt and run an Ansible Playbook on it. The reason I created a 2Gb of RAM machine and I’ve not tried to shrink it further is because the Ansible Tower installation checks for 2Gb of RAM, and I wanted to create something easy. I’m sure I could patch the installer to accept a 1Gb machine, but it’s not worth the effort to me. Also, in my usual usage of the computer I rarely go below 11Gb free memory, so I’m not too concerned in giving 2Gb to my VM.

Read More

Vagrant etcd cluster

March 21, 2017

Sometimes I need to do some tests which are destructive and I need to perform them over and over until I figure out a process that reliably brings me to a desired state. I usually create some kind of easy to provision environments and work on it.

In the last few weeks I found myself working on an etcd cluster, so I created an environment with Vagrant, and since I had to write the majority of this by myself, since I have not found anything on Google that suited my needs, I’m going to share this with you.

Read More