Skip to content

Instantly share code, notes, and snippets.

@jdoss
Created November 1, 2015 03:08
Show Gist options
  • Save jdoss/b780d5e8cebc9344dde2 to your computer and use it in GitHub Desktop.
Save jdoss/b780d5e8cebc9344dde2 to your computer and use it in GitHub Desktop.
A Vagrantfile that works with Open vSwitch on :public_network
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.define :dev do |dev|
dev.vm.box = "centos/7"
dev.vm.hostname = "ansible"
dev.vm.network :public_network, :dev => "ovsbr0", :ovs => true
dev.vm.synced_folder ".", "/home/vagrant/sync", disabled: true
dev.vm.provider :libvirt do |libvirt|
libvirt.memory = 1024
libvirt.cpus = 2
libvirt.driver = "kvm"
#libvirt.host = "localhost"
#libvirt.connect_via_ssh = false
#libvirt.username = "root"
#libvirt.password = "secret"
#libvirt.storage_pool_name = "default"
#libvirt.default_prefix = ''
end
end
config.vm.provision "shell" do |s|
ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_rsa.pub").first.strip
s.inline = <<-SHELL
echo #{ssh_pub_key} >> /home/vagrant/.ssh/authorized_keys
SHELL
end
# config.vm.provision "ansible" do |ansible|
# ansible.playbook = "playbook.yaml"
# ansible.verbose = 'vvvv'
# end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment