Last active
August 29, 2015 14:26
-
-
Save podhmo/4a015cf87aa4cbc7e4cd to your computer and use it in GitHub Desktop.
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 = ../repo/bin/ansible | |
define INVENTORY | |
[all] | |
default | |
endef | |
define VAGRANT | |
# -*- 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 = "ubuntu15.04x64" | |
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/vivid/current/vivid-server-cloudimg-amd64-vagrant-disk1.box" | |
config.vm.network :private_network, type: :dhcp | |
config.vm.network "forwarded_port", guest: 7654, host: 7654 | |
# config.vm.synced_folder "../data", "/vagrant_data" | |
_packages = %q!python-pip git-core python-dev python3 python3-dev python3-pip! | |
_script = <<SCRIPT | |
echo I am provisioning... | |
ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime | |
test ! -f /etc/apt/sources.list.bak && cp /etc/apt/sources.list /etc/apt/sources.list.bak | |
sed -i 's@archive\.ubuntu\.com/ubuntu@ftp.jaist.ac.jp/pub/Linux/ubuntu@g' /etc/apt/sources.list | |
apt-get update | |
apt-get -y install #{_packages} | |
pip install virtualenv | |
SCRIPT | |
config.vm.provision "shell", inline: _script | |
end | |
endef | |
export VAGRANT | |
export INVENTORY | |
setup: | |
mkdir -p inventory | |
echo "$$INVENTORY" > inventory/vagrant | |
echo "$$VAGRANT" > Vagrantfile | |
vagrant up | |
vagrant ssh-config > ssh.config | |
ping: | |
ANSIBLE_ARGS=' -F ssh.config' ${ansible} -m ping -i inventory/vagrant all | |
default: setup ping | |
.PHONY: ping setup | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment