Last active
July 11, 2017 18:52
-
-
Save hgranillo/fec2c502363e3d7be79cc26598b38c0a to your computer and use it in GitHub Desktop.
Vagranfile for testing Ansible playbooks con several distros
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vagrant.require_version ">= 1.7.0" | |
Vagrant.configure(2) do |config| | |
config.vm.provider :virtualbox do |vb| | |
vb.gui = false | |
vb.customize [ 'modifyvm', :id, '--memory', '512' ] | |
vb.customize [ 'modifyvm', :id, '--nictype1', 'virtio' ] | |
vb.customize [ 'modifyvm', :id, '--natdnshostresolver1', 'on' ] | |
vb.customize [ 'modifyvm', :id, '--natdnsproxy1', 'on' ] | |
end | |
# Debian | |
config.vm.define 'debian' do |debian| | |
#config.vm.network "private_network", ip: "55.55.55.5" | |
debian.vm.box = "debian/jessie64" | |
debian.vm.hostname = 'debian' | |
debian.ssh.insert_key = false | |
debian.vm.provision "ansible" do |ansible| | |
ansible.verbose = "v" | |
ansible.playbook = "tests/playbook.yml" | |
end | |
end | |
# Amazon Linux | |
config.vm.define 'amazon', primary: true do |amazon| | |
amazon.vm.box = "mvbcoding/awslinux" | |
amazon.ssh.insert_key = false | |
amazon.vm.provision "ansible" do |ansible| | |
ansible.verbose = "v" | |
ansible.playbook = "tests/playbook.yml" | |
end | |
end | |
# Centos 6 | |
config.vm.define 'centos6' do |centos6| | |
centos6.vm.box = "centos/6" | |
centos6.ssh.insert_key = false | |
centos6.vm.provision "ansible" do |ansible| | |
ansible.verbose = "v" | |
ansible.playbook = "tests/playbook.yml" | |
end | |
end | |
# Centos 7 | |
config.vm.define 'centos7' do |centos7| | |
centos7.vm.box = "centos/7" | |
centos7.ssh.insert_key = false | |
centos7.vm.provision "ansible" do |ansible| | |
ansible.verbose = "v" | |
ansible.playbook = "tests/playbook.yml" | |
end | |
end | |
# Ubuntu14 | |
config.vm.define 'ubuntu14' do |ubuntu14| | |
ubuntu14.vm.box = "ubuntu/trusty64" | |
ubuntu14.ssh.insert_key = false | |
ubuntu14.vm.provision "ansible" do |ansible| | |
ansible.verbose = "v" | |
ansible.playbook = "tests/playbook.yml" | |
end | |
end | |
# Ubuntu16 | |
config.vm.define 'ubuntu16' do |ubuntu16| | |
ubuntu16.vm.box = "ubuntu/xenial64" | |
# Oficial Ubuntu Xenial images dont follow the vagrant:vagrant user practice | |
# workarround, set ssh.insert_key to TRUE and ssh.username to ubuntu | |
ubuntu16.ssh.insert_key = true | |
ubuntu16.ssh.username = "ubuntu" | |
ubuntu16.vm.provision "ansible" do |ansible| | |
ansible.verbose = "v" | |
ansible.playbook = "tests/playbook.yml" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment