Using Ansible without Vagrant

Vagrant is the default but you can also use Ansible directly if you prefer.

Projects: c2platform/ansible

This how-to describes how you can use Ansible without Vagrant in this project. This only requires a little bit of SSH configuration in .ssh/config. The added bonus is that you can SSH into boxes without Vagrant. In this setup the c2d-rproxy1 node starts fulfilling a third role as a bastion / jump server  .


There are several ways to utilize Ansible within the c2platform/ansible project. These different approaches are illustrated in the PlantUML diagram below. The default and most efficient method is to employ Vagrant, represented by the black line. Vagrant acts as a driver for Ansible through its Ansible Provisioner  .

Another option we are currently exploring, depicted by the red line, is to use Ansible directly without Vagrant.

Additional options for utilizing Ansible include:

  • Green Line: Utilizing the c2d-xtop node, which can be created (using Vagrant) by executing vagrant up c2d-xtop. Once created, you can connect to it using an RDP or SSH connection by executing vagrant ssh c2d-xtop.
  • Blue Line: Employing AWX. For more information, refer to the guide on setting up AWX: Setup AWX.

SSH config

Edit .ssh/config and add entry shown below. This allows access to all nodes using SSH hops via c2d-rproxy1.

Host c2d-*
  ProxyCommand ssh -W %h:%p
  User vagrant
  IdentityFile ~/.vagrant.d/insecure_private_key
  StrictHostkeyChecking no
  UserKnownHostsFile /dev/null
  LogLevel INFO
  Compression yes
  ServerAliveInterval 10
  ServerAliveCountMax 10


Start c2d-rproxy1, c2d-rproxy2 and SSH into the node. Note: that we are using ssh and not vagrant ssh, so we are bypassing Vagrant altogether.

vagrant up c2d-rproxy1 c2d-rproxy2
ssh c2d-rproxy1
ssh c2d-rproxy2

Now you should also be able to run Ansible directly, without Vagrant, for example with command similar to below.

source ~/.virtualenv/uwd/bin/activate
export ANSIBLE_CONFIG=$PWD/ansible-dev.cfg
ansible-playbook plays/mw/reverse_proxy.yml -i hosts-dev.ini --limit c2d-rproxy2


See Manage the RWS Ansible Execution Environment for a practical example for which this is useful.