Skip to content

Instantly share code, notes, and snippets.

@jmyoung
Created August 26, 2016 04:38
Show Gist options
  • Save jmyoung/fb034677ad332da5809fed4698ce55dc to your computer and use it in GitHub Desktop.
Save jmyoung/fb034677ad332da5809fed4698ce55dc to your computer and use it in GitHub Desktop.
vagrant with ansible-local example
[defaults]
host_key_checking = no
[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes
ansible-example ansible_connection=local
---
- hosts: ansible-example
tasks:
- copy: content="IT WORKS!" dest=/home/vagrant/ansible_runs
...
# -*- 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