5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

こんな感じでどうでしょう

Last updated at Posted at 2014-04-03
Vagrantfile
Vagrant.require_version ">= 1.5.0"

Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/precise64"

  # Attach the current directory for Packer and Ansible
  config.vm.synced_folder ".", "/vagrant"

  # Install Packer
  config.vm.provision :shell, :inline => <<-PREPARE
    apt-get -y update
    apt-get install -y wget unzip curl

    mkdir -p /home/vagrant/packer
    cd /home/vagrant/packer
    if [ ! -e 0.5.2_linux_amd64.zip ]; then
      wget https://dl.bintray.com/mitchellh/packer/0.5.2_linux_amd64.zip
      unzip 0.5.2_linux_amd64.zip
      echo "export PATH=$PATH:/home/vagrant/packer" > /home/vagrant/.bashrc
    fi
  PREPARE

  # Use Docker provisioner to install Docker
  config.vm.provision :docker do |d|
    d.pull_images "ubuntu:13.10"
  end

  # Run Packer
  config.vm.provision :shell, :inline => <<-PACKER
    cd /vagrant
    packer build template.json
  PACKER

  # Check results
  config.vm.provision :shell, :inline => <<-RESULTS
    docker images

    docker run hexa/ubuntu/base:0.1 /opt/python/2.7.6/bin/python -V

    docker run hexa/ubuntu/base:0.1 /opt/ruby/2.1.1/bin/ruby -v
  RESULTS
end
5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?