Setup Ansible Control Machine On Windows 10 with Vagrant Image (Ubuntu)


This post will demonstrate how to setup an Ansible control machine on a Windows 10 box leveraging a Ubuntu Vagrant image.


Why might you want to do this?


Software Prerequisites:


Let’s Build…

On Windows 10 machine, do the following:

directory “C:\HashiCorp\Vagrant\” should already exist after Vagrant has been installed:
cd c:\HashiCorp\Vagrant\
create “ansible” directory, will build Ubuntu Vagrant image inside here:
mkdir ansible
create “share”, will be shared/sync directory between Windows 10 and Vagrant image:
mkdir ansible\share
 change into “ansible” directory, build Vagrant image and SSH into Vagrant image:
cd ansible
vagrant init ubuntu/xenial64
vagrant up
vagrant ssh

Now inside the Vagrant image, do the following:

install Ansible via apt-get (Ubuntu), as noted here on Ansible docs:
sudo apt-get update
sudo apt-get install software-properties-common
sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install ansible
install ‘tree’, this is a “nice to have” utility to list files and directories, more info here:
sudo apt-get install tree


Setup complete.  Let’s Verify…

To recap, the “shared folder” that can be used to sync Ansible playbooks between Windows 10 and Ubuntu Vagrant image:

  • Ubuntu Vagrant image acting as Ansible control machine, share path is:  “/vagrant/share
  • Windows 10 box, share path is:  “C:\HashiCorp\Vagrant\ansible\share

Sample screenshot showing files/directories created within Ubuntu Vagrant image were synced to Windows 10 box:



Leave a Reply

Your email address will not be published. Required fields are marked *