
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