読者です 読者をやめる 読者になる 読者になる

by shigemk2

当面は技術的なことしか書かない

VagrantでVM10コ立ち上げてpuppetでscreenをインストールしてみた

Vagrant puppet

vagrantでVMを一度に複数台立てる - $shibayu36->blog;

Puppet Apply - Provisioning - Vagrant Documentation

とりあえずやってみたかったのでやってみた。

boxは適当なものをaddする。

$ vagrant box add centos6.4.x86_64 https://github.com/2creatives/vagrant-centos/releases/download/v0.1.0/centos64-x86_64-20131030.box

Vagrantfile

# -*- coding: utf-8 -*-
# -*- mode: ruby -*-
Vagrant.configure("2") do |config|
  config.vm.box = "centos6.4.x86_64"

  config.vm.provision :puppet do |puppet|
    puppet.manifests_path = "manifests"
    puppet.manifest_file  = "default.pp"
  end

  config.vm.define :web1 do |web|
    web.vm.network :private_network, ip: "192.168.1.11"
    web.vm.network :forwarded_port, host: 8001, guest: 8000
  end

  config.vm.define :web2 do |web|
    web.vm.network :private_network, ip: "192.168.1.12"
    web.vm.network :forwarded_port, host: 8002, guest: 8000
  end

  config.vm.define :web3 do |web|
    web.vm.network :private_network, ip: "192.168.1.13"
    web.vm.network :forwarded_port, host: 8003, guest: 8000
  end

  config.vm.define :web4 do |web|
    web.vm.network :private_network, ip: "192.168.1.14"
    web.vm.network :forwarded_port, host: 8004, guest: 8000
  end

  config.vm.define :web5 do |web|
    web.vm.network :private_network, ip: "192.168.1.15"
    web.vm.network :forwarded_port, host: 8005, guest: 8000
  end

  config.vm.define :web6 do |web|
    web.vm.network :private_network, ip: "192.168.1.16"
    web.vm.network :forwarded_port, host: 8006, guest: 8000
  end

  config.vm.define :web7 do |web|
    web.vm.network :private_network, ip: "192.168.1.17"
    web.vm.network :forwarded_port, host: 8007, guest: 8000
  end

  config.vm.define :web8 do |web|
    web.vm.network :private_network, ip: "192.168.1.18"
    web.vm.network :forwarded_port, host: 8008, guest: 8000
  end

  config.vm.define :web9 do |web|
    web.vm.network :private_network, ip: "192.168.1.19"
    web.vm.network :forwarded_port, host: 8009, guest: 8000
  end

  config.vm.define :web10 do |web|
    web.vm.network :private_network, ip: "192.168.1.10"
    web.vm.network :forwarded_port, host: 8010, guest: 8000
  end
end
$ mkdir manifests
$ vi manifests/default.pp
package { "screen":
    ensure => "installed"
}

そして vagrant up

しかし。

The `puppet` binary appears not to be in the PATH of the guest. This
could be because the PATH is not properly setup or perhaps Puppet is not
installed on this guest. Puppet provisioning can not continue without
Puppet properly installed.

fxxx

これで1時間くらい時間潰した気がするんですが、要するにpuppetがVMに入ってないって ことらしいよ。うわ。全部のサーバーにpuppet入れないといけないのか。

しょうがないから全部のサーバーに入れました。

$ sudo yum install -y puppet

vagrant reload --provision
[web1] Attempting graceful shutdown of VM...
[web1] Clearing any previously set forwarded ports...
[web1] Clearing any previously set network interfaces...
[web1] Preparing network interfaces based on configuration...
[web1] Forwarding ports...
[web1] -- 22 => 2222 (adapter 1)
[web1] -- 8000 => 8001 (adapter 1)
[web1] Booting VM...
[web1] Waiting for machine to boot. This may take a few minutes...
[web1] Machine booted and ready!
[web1] Configuring and enabling network interfaces...
[web1] Mounting shared folders...
[web1] -- /vagrant
[web1] -- /tmp/vagrant-puppet-1/manifests
[web1] Running provisioner: puppet...
Running Puppet with default.pp...
notice: Finished catalog run in 5.14 seconds
[web2] Attempting graceful shutdown of VM...
[web2] Clearing any previously set forwarded ports...
[web2] Fixed port collision for 22 => 2222. Now on port 2200.
[web2] Clearing any previously set network interfaces...
[web2] Preparing network interfaces based on configuration...
[web2] Forwarding ports...
[web2] -- 22 => 2200 (adapter 1)
[web2] -- 8000 => 8002 (adapter 1)
[web2] Booting VM...
[web2] Waiting for machine to boot. This may take a few minutes...
[web2] Machine booted and ready!
[web2] Configuring and enabling network interfaces...
[web2] Mounting shared folders...
[web2] -- /vagrant
[web2] -- /tmp/vagrant-puppet-1/manifests
[web2] Running provisioner: puppet...
Running Puppet with default.pp...
notice: Finished catalog run in 1.21 seconds
[web3] Attempting graceful shutdown of VM...
[web3] Clearing any previously set forwarded ports...
[web3] Fixed port collision for 22 => 2200. Now on port 2201.
[web3] Clearing any previously set network interfaces...
[web3] Preparing network interfaces based on configuration...
[web3] Forwarding ports...
[web3] -- 22 => 2201 (adapter 1)
[web3] -- 8000 => 8003 (adapter 1)
[web3] Booting VM...
[web3] Waiting for machine to boot. This may take a few minutes...
[web3] Machine booted and ready!
[web3] Configuring and enabling network interfaces...
[web3] Mounting shared folders...
[web3] -- /vagrant
[web3] -- /tmp/vagrant-puppet-1/manifests
[web3] Running provisioner: puppet...
Running Puppet with default.pp...
notice: Finished catalog run in 1.38 seconds
[web4] Attempting graceful shutdown of VM...
[web4] Clearing any previously set forwarded ports...
[web4] Fixed port collision for 22 => 2201. Now on port 2202.
[web4] Clearing any previously set network interfaces...
[web4] Preparing network interfaces based on configuration...
[web4] Forwarding ports...
[web4] -- 22 => 2202 (adapter 1)
[web4] -- 8000 => 8004 (adapter 1)
[web4] Booting VM...
[web4] Waiting for machine to boot. This may take a few minutes...
[web4] Machine booted and ready!
[web4] Configuring and enabling network interfaces...
[web4] Mounting shared folders...
[web4] -- /vagrant
[web4] -- /tmp/vagrant-puppet-1/manifests
[web4] Running provisioner: puppet...
Running Puppet with default.pp...
notice: Finished catalog run in 1.21 seconds
[web5] Attempting graceful shutdown of VM...
[web5] Clearing any previously set forwarded ports...
[web5] Fixed port collision for 22 => 2202. Now on port 2203.
[web5] Clearing any previously set network interfaces...
[web5] Preparing network interfaces based on configuration...
[web5] Forwarding ports...
[web5] -- 22 => 2203 (adapter 1)
[web5] -- 8000 => 8005 (adapter 1)
[web5] Booting VM...
[web5] Waiting for machine to boot. This may take a few minutes...
[web5] Machine booted and ready!
[web5] Configuring and enabling network interfaces...
[web5] Mounting shared folders...
[web5] -- /vagrant
[web5] -- /tmp/vagrant-puppet-1/manifests
[web5] Running provisioner: puppet...
Running Puppet with default.pp...
notice: /Stage[main]//Package[screen]/ensure: created
notice: Finished catalog run in 17.16 seconds
[web6] Attempting graceful shutdown of VM...
[web6] Clearing any previously set forwarded ports...
[web6] Fixed port collision for 22 => 2203. Now on port 2204.
[web6] Clearing any previously set network interfaces...
[web6] Preparing network interfaces based on configuration...
[web6] Forwarding ports...
[web6] -- 22 => 2204 (adapter 1)
[web6] -- 8000 => 8006 (adapter 1)
[web6] Booting VM...
[web6] Waiting for machine to boot. This may take a few minutes...
[web6] Machine booted and ready!
[web6] Configuring and enabling network interfaces...
[web6] Mounting shared folders...
[web6] -- /vagrant
[web6] -- /tmp/vagrant-puppet-1/manifests
[web6] Running provisioner: puppet...
Running Puppet with default.pp...
notice: /Stage[main]//Package[screen]/ensure: created
notice: Finished catalog run in 48.51 seconds
[web7] Attempting graceful shutdown of VM...
[web7] Clearing any previously set forwarded ports...
[web7] Fixed port collision for 22 => 2204. Now on port 2205.
[web7] Clearing any previously set network interfaces...
[web7] Preparing network interfaces based on configuration...
[web7] Forwarding ports...
[web7] -- 22 => 2205 (adapter 1)
[web7] -- 8000 => 8007 (adapter 1)
[web7] Booting VM...
[web7] Waiting for machine to boot. This may take a few minutes...
[web7] Machine booted and ready!
[web7] Configuring and enabling network interfaces...
[web7] Mounting shared folders...
[web7] -- /vagrant
[web7] -- /tmp/vagrant-puppet-1/manifests
[web7] Running provisioner: puppet...
Running Puppet with default.pp...
notice: /Stage[main]//Package[screen]/ensure: created
notice: Finished catalog run in 21.18 seconds
[web8] Attempting graceful shutdown of VM...
[web8] Clearing any previously set forwarded ports...
[web8] Fixed port collision for 22 => 2205. Now on port 2206.
[web8] Clearing any previously set network interfaces...
[web8] Preparing network interfaces based on configuration...
[web8] Forwarding ports...
[web8] -- 22 => 2206 (adapter 1)
[web8] -- 8000 => 8008 (adapter 1)
[web8] Booting VM...
[web8] Waiting for machine to boot. This may take a few minutes...
[web8] Machine booted and ready!
[web8] Configuring and enabling network interfaces...
[web8] Mounting shared folders...
[web8] -- /vagrant
[web8] -- /tmp/vagrant-puppet-1/manifests
[web8] Running provisioner: puppet...
Running Puppet with default.pp...
notice: /Stage[main]//Package[screen]/ensure: created
notice: Finished catalog run in 16.99 seconds
[web9] Attempting graceful shutdown of VM...
[web9] Clearing any previously set forwarded ports...
[web9] Fixed port collision for 22 => 2206. Now on port 2207.
[web9] Clearing any previously set network interfaces...
[web9] Preparing network interfaces based on configuration...
[web9] Forwarding ports...
[web9] -- 22 => 2207 (adapter 1)
[web9] -- 8000 => 8009 (adapter 1)
[web9] Booting VM...
[web9] Waiting for machine to boot. This may take a few minutes...
[web9] Machine booted and ready!
[web9] Configuring and enabling network interfaces...
[web9] Mounting shared folders...
[web9] -- /vagrant
[web9] -- /tmp/vagrant-puppet-1/manifests
[web9] Running provisioner: puppet...
Running Puppet with default.pp...
notice: /Stage[main]//Package[screen]/ensure: created
notice: Finished catalog run in 18.03 seconds
[web10] Attempting graceful shutdown of VM...
[web10] Clearing any previously set forwarded ports...
[web10] Fixed port collision for 22 => 2207. Now on port 2208.
[web10] Clearing any previously set network interfaces...
[web10] Preparing network interfaces based on configuration...
[web10] Forwarding ports...
[web10] -- 22 => 2208 (adapter 1)
[web10] -- 8000 => 8010 (adapter 1)
[web10] Booting VM...
[web10] Waiting for machine to boot. This may take a few minutes...
[web10] Machine booted and ready!
[web10] Configuring and enabling network interfaces...
[web10] Mounting shared folders...
[web10] -- /vagrant
[web10] -- /tmp/vagrant-puppet-1/manifests
[web10] Running provisioner: puppet...
The `puppet` binary appears not to be in the PATH of the guest. This
could be because the PATH is not properly setup or perhaps Puppet is not
installed on this guest. Puppet provisioning can not continue without
Puppet properly installed.

(意図的にweb10にはpuppetを入れなかった)

すべてのサーバーで which screenしたけど、screen入ってた。

うん。たん。