-
-
Save jmyoung/fb034677ad332da5809fed4698ce55dc to your computer and use it in GitHub Desktop.
vagrant with ansible-local example
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
[defaults] | |
host_key_checking = no | |
[ssh_connection] | |
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes |
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
ansible-example ansible_connection=local |
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: ansible-example | |
tasks: | |
- copy: content="IT WORKS!" dest=/home/vagrant/ansible_runs | |
... |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
# The default ubuntu/xenial64 image has issues with vbguest additions | |
config.vm.box = "bento/ubuntu-16.04" | |
# Set memory for the default VM | |
config.vm.provider "virtualbox" do |vb| | |
vb.memory = "1024" | |
end | |
# Configure vbguest auto update options | |
config.vbguest.auto_update = false | |
config.vbguest.no_install = false | |
config.vbguest.no_remote = true | |
# Configure the hostname for the default machine | |
config.vm.hostname = "ansible-example" | |
# Mount this folder as RO in the guest, since it contains secure stuff | |
config.vm.synced_folder "vagrant", "/vagrant", :mount_options => ["ro"] | |
# And finally run the Ansible local provisioner | |
config.vm.provision "ansible_local" do |ansible| | |
ansible.provisioning_path = "/vagrant/provisioning" | |
ansible.inventory_path = "inventory" | |
ansible.playbook = "playbook.yml" | |
ansible.limit = "all" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment