Skip to content

Instantly share code, notes, and snippets.

@EmmanuelKasper
Last active December 25, 2015 17:29
Show Gist options
  • Save EmmanuelKasper/7013237 to your computer and use it in GitHub Desktop.
Save EmmanuelKasper/7013237 to your computer and use it in GitHub Desktop.
If you've just downloaded one of the vagrant base boxes from http://www.vagrantbox.es/, this gist shows you how to tame them with ansible
# create a temporary inventory file
echo "vagrant ansible_ssh_host=localhost ansible_ssh_user=vagrant ansible_ssh_port=2222" > hosts
# run a root shell in the vagrant env
ansible \
--inventory hosts \
--private-key=/opt/vagrant/embedded/gems/gems/vagrant-1.2.7/keys/vagrant \
--sudo \
--args "id" vagrant
# if your downloaded base box is debian based, you will probably need "python-apt" before any use of the apt-module
ansible \
--inventory hosts \
--private-key=/opt/vagrant/embedded/gems/gems/vagrant-1.2.7/keys/vagrant \
--sudo \
--args "apt-get install python-apt" vagrant
#then of course you're free to use anyplaybook
ansible-playbook \
--inventory hosts \
--private-key=/opt/vagrant/embedded/gems/gems/vagrant-1.2.7/keys/vagrant \
--sudo \
playbook.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment