在 Vagrant 管理的 Ubuntu 14.04.2 LTS 上安裝 Chef Server 時發生錯誤

在 Vagrant 管理的 Ubuntu 14.04.2 LTS 上安裝 Chef Server 時發生錯誤

我正在嘗試使用 Vagrant/VirtualBox 在本機虛擬機器上設定 Chef 伺服器。我的 Vagrant 文件是:

Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/trusty64"
  config.vm.hostname = "dtom-chef-server"
  config.vm.provision :shell, path: "bootstrap.sh"
  config.vm.network :forwarded_port, host: 4567, guest: 80
end

我的bootstrap.sh腳本如下:

# Set hostname and FQDN
hostnamectl set-hostname dtom-chef-server
IPADDR="$(ifconfig eth0|grep -Po 't addr:\K[\d.]+')"
sed "s/ip-addr/$IPADDR/g" /vagrant/hosts_orig > /etc/hosts

# Install Chef server
cd && mkdir downloads && cd downloads
wget https://web-dl.packagecloud.io/chef/stable/packages/ubuntu/trusty/chef-server-core_12.0.8-1_amd64.deb
dpkg -i chef-server-core_*.deb
chef-server-ctl reconfigure

一切似乎都運作良好,直到我得到

==> default: [2015-05-05T19:48:38+00:00] INFO: Processing execute[oc_id_schema] action run (private-chef::oc_id line 130)
==> default:
==> default:================================================================================
==> default: Error executing action `run` on resource 'execute[oc_id_schema]'
==> default: ================================================================================
==> default:
==> default: Mixlib::ShellOut::ShellCommandFailed
==> default: ------------------------------------
==> default: Expected process to exit with [0], but received ''
==> default: ---- Begin output of bundle exec rake db:migrate ----
==> default: STDOUT:
==> default: STDERR: no ruby in PATH/CONFIG
==> default: ---- End output of bundle exec rake db:migrate ----
==> default: Ran bundle exec rake db:migrate returned

安裝似乎繼續進行,但我認為這就是我收到錯誤的原因:

==> default: ================================================================================
==> default: Error executing action `restart` on resource 'runit_service[oc_id]'
==> default: ================================================================================
==> default:
==> default:
==> default: Mixlib::ShellOut::ShellCommandFailed
==> default: ------------------------------------
==> default: Expected process to exit with [0], but received '1'
==> default:
==> default: ---- Begin output of /opt/opscode/embedded/bin/sv restart /opt/opscode/service/oc_id ----
==> default:
==> default: STDOUT: fail: /opt/opscode/service/oc_id: unable to change to service directory: file does not exist

最後,雖然我不確定這是否相關,但我得到:

FATAL: Chef::Exceptions::CannotDetermineNodeName: Unable to determine node name: configure node_name or configure the system's hostname and fqdn

然後進程退出。我在安裝過程中遺漏了什麼嗎?

相關內容