Skip to content

Instantly share code, notes, and snippets.

@dopry
Last active August 29, 2015 14:09
Show Gist options
  • Save dopry/4bc4f2d852b8055a7b68 to your computer and use it in GitHub Desktop.
Save dopry/4bc4f2d852b8055a7b68 to your computer and use it in GitHub Desktop.
Example for Ansible copy module error,
[web]
127.0.0.1
#!/usr/bin/env bash
export DEBIAN_FRONTEND=noninteractive
apt-get install -y -q python-pip
pip install ansible
# setting up local SSH keys.
if [ ! -f /home/vagrant/.ssh/id_rsa ]; then
echo "Generate SSH Key"
ssh-keygen -t rsa -N "" -f /home/vagrant/.ssh/id_rsa
fi
cat /home/vagrant/.ssh/id_rsa.pub >> /home/vagrant/.ssh/authorized_keys
ssh-keyscan -t rsa,dsa 127.0.0.1 2>&1 > /home/vagrant/.ssh/known_hosts
chmod 0600 /home/vagrant/.ssh/authorized_keys
chmod 0600 /home/vagrant/.ssh/id_rsa
chmod 0644 /home/vagrant/.ssh/id_rsa.pub
chmod 0644 /home/vagrant/.ssh/known_hosts
chown -R vagrant:vagrant /home/vagrant/.ssh
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
# forward gulp hosted client from vagrant to host.
config.vm.network "forwarded_port", guest: 8080, host: 8080
config.vm.hostname = "vagrant.dev"
config.vm.network "private_network", ip: "192.168.34.10"
config.ssh.forward_agent = true
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
config.vm.provision "shell", path: "provision.sh"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment