Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Ansible Local Testenvironment Setup for Windows based on Vagrant and Virtualbox
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
config.vm.define "managed-node" do |ubuntu| = "bento/ubuntu-18.04" "private_network", ip: ""
ubuntu.vm.provision "shell", inline: <<-SHELL
sudo apt-get update
sudo apt-get install python -y
config.vm.define "control-node" do |vbox| = "bento/ubuntu-18.04"
vbox.vm.synced_folder ".", "/vagrant"
vbox.vm.provision "shell", inline: <<-SHELL
sudo apt-get update -y
sudo apt-get install -y software-properties-common
sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update -y
sudo apt-get install -y ansible
vbox.vm.provision "shell", privileged: false, inline: <<-SHELL
ssh-keygen -t rsa -q -f "/home/vagrant/.ssh/id_rsa" -N ""
ssh-keygen -R
ssh-keyscan -t rsa -H >> /home/vagrant/.ssh/known_hosts
sshpass -p 'vagrant' ssh-copy-id -i /home/vagrant/.ssh/ vagrant@
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
# vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
# vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.