Last active
December 25, 2015 17:29
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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