Skip to content

Instantly share code, notes, and snippets.

@hugollm
Created May 12, 2017 19:02
Show Gist options
  • Save hugollm/3faf805c7f3519c0e123dff48e5c1bef to your computer and use it in GitHub Desktop.
Save hugollm/3faf805c7f3519c0e123dff48e5c1bef to your computer and use it in GitHub Desktop.
Vagrantfile to spawn an ubuntu box with python and ssh (ready for ansible scripts)
host_public_key = File.readlines("#{Dir.home}/.ssh/id_rsa.pub").first.strip
setup_ssh = <<SCRIPT
mkdir -p /home/ubuntu/.ssh
echo '#{host_public_key}' >> /home/ubuntu/.ssh/authorized_keys
SCRIPT
install_python = 'DEBIAN_FRONTEND=noninteractive apt-get install -y python'
Vagrant.configure('2') do |config|
config.vm.box = 'ubuntu/xenial64'
config.vm.hostname = 'groupstake'
config.vm.network 'private_network', ip: '172.28.128.5'
config.vm.provision :shell, inline: setup_ssh, privileged: false
config.vm.provision :shell, inline: install_python, privileged: true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment