Last active
January 7, 2016 15:14
-
-
Save cescoferraro/156e1adb6f0f5ceadc41 to your computer and use it in GitHub Desktop.
nearly empty playbook to trigger vagrant to create a valid Ansible inventory and keys
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 folder, here we call it /tmp/ansible-vagrant | |
* paste this two files inside | |
run: | |
$ vagrant up && vagrant provisioning | |
* this will create those both files that you will need to run ansible againt the box | |
/tmp/ansible-vagrant.vagrant/machines/default/virtualbox/private_key | |
/tmp/ansible-vagrant.vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory | |
ansible-playbook --private-key=.vagrant/machines/default/virtualbox/private_key \ | |
-u vagrant \ | |
-i .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory \ | |
path/to/the/playbook.yml |
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
--- | |
- hosts: all | |
tasks: | |
- debug: msg="Please work Vagrant!" |
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
# This guide is optimized for Vagrant 1.7 and above. | |
# Although versions 1.6.x should behave very similarly, it is recommended | |
# to upgrade instead of disabling the requirement below. | |
Vagrant.require_version ">= 1.7.0" | |
Vagrant.configure(2) do |config| | |
config.vm.box = "ubuntu/trusty64" | |
# Disable the new default behavior introduced in Vagrant 1.7, to | |
# ensure that all Vagrant machines will use the same SSH key pair. | |
# See https://github.com/mitchellh/vagrant/issues/5005 | |
config.ssh.insert_key = false | |
config.vm.provision "ansible" do |ansible| | |
ansible.verbose = "v" | |
ansible.playbook = "playbook.yml" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment