Using Ansible without Vagrant

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

Projects: c2platform/phx/ansible


To be able to use Ansible directly without Vagrant with other words in order to be able to run for example ansible-playbook you have to change SSH config on your machine.

SSH config

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

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

Verify

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

vagrant up pxd-rproxy1
ssh pxd-rproxy1

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 pxd-rproxy1


Last modified May 22, 2025: phx dev environment PHX-1 (98524a6)