| 1 | # -*- mode: ruby -*-
|
|---|
| 2 | # vi: set ft=ruby :
|
|---|
| 3 |
|
|---|
| 4 | # All Vagrant configuration is done below. The "2" in Vagrant.configure
|
|---|
| 5 | # configures the configuration version (we support older styles for
|
|---|
| 6 | # backwards compatibility). Please don't change it unless you know what
|
|---|
| 7 | # you're doing.
|
|---|
| 8 | VAGRANTFILE_API_VERSION = "2"
|
|---|
| 9 |
|
|---|
| 10 | $script = <<EOF
|
|---|
| 11 | sudo apt update
|
|---|
| 12 | echo "Y" | sudo apt install wget ntp openssl-devel
|
|---|
| 13 | sudo ntpdate ntp.nict.jp
|
|---|
| 14 | (cd /tmp && wget https://packagecloud.io/chef/stable/packages/ubuntu/trusty/chef-server-core_12.3.1-1_amd64.deb/download)
|
|---|
| 15 | mv /tmp/download /tmp/chef-server-core_12.3.1-1_amd64.deb
|
|---|
| 16 | sudo dpkg -i /tmp/chef-server-core_12.3.1-1_amd64.deb
|
|---|
| 17 | sudo chef-server-ctl reconfigure
|
|---|
| 18 | EOF
|
|---|
| 19 |
|
|---|
| 20 | $client_script = <<EOF
|
|---|
| 21 | sudo apt update
|
|---|
| 22 | echo "Y" | sudo apt install wget ntp openssl-devel
|
|---|
| 23 | (cd /tmp && wget https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/10.04/x86_64/chef_12.5.1-1_amd64.deb)
|
|---|
| 24 | sudo dpkg -i /tmp/chef_12.5.1-1_amd64.deb
|
|---|
| 25 | sudo bash -c "echo '192.168.11.8 chef-server' >> /etc/hosts"
|
|---|
| 26 | EOF
|
|---|
| 27 |
|
|---|
| 28 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|---|
| 29 | config.omnibus.chef_version = :lataset
|
|---|
| 30 | config.vm.provider "virtualbox" do |vbox|
|
|---|
| 31 | vbox.gui = false
|
|---|
| 32 | vbox.memory = "1024"
|
|---|
| 33 | vbox.cpus = "2"
|
|---|
| 34 | end
|
|---|
| 35 | config.vm.define :chef_server do |host|
|
|---|
| 36 | host.vm.box = 'ubuntu/trusty32'
|
|---|
| 37 | host.vm.box_url = 'https://atlas.hashicorp.com/ubuntu/boxes/trusty32'
|
|---|
| 38 | host.vm.hostname = 'chef-server'
|
|---|
| 39 | host.vm.network :private_network, ip: '192.168.4.8'
|
|---|
| 40 | host.vm.provision :shell, :inline => $script
|
|---|
| 41 | end
|
|---|
| 42 |
|
|---|
| 43 | config.vm.define :chef_client do |host|
|
|---|
| 44 | host.vm.box = 'ubuntu/trusty32'
|
|---|
| 45 | host.vm.box_url = 'https://atlas.hashicorp.com/ubuntu/boxes/trusty32'
|
|---|
| 46 | host.vm.hostname = 'chef-client'
|
|---|
| 47 | host.vm.network :private_network, ip: '192.168.4.9'
|
|---|
| 48 | host.vm.provision :shell, :inline => $client_script
|
|---|
| 49 | end
|
|---|
| 50 | end
|
|---|