我正在尝试使用puppet在一个新鲜的流浪盒上安装节点,但是当运行清单时,我在框中会出现以下错误。
Warning: Config file /etc/puppet/hiera.yaml not found, using Hiera defaults
Warning: Scope(Apt::Source[nodesource]): $include_src is deprecated and will be removed in the next major release, please use $include => { 'src' => false } instead
Warning: Scope(Apt::Source[nodesource]): $required_packages is deprecated and will be removed in the next major release, please use package resources instead.
Warning: Scope(Apt::Source[nodesource]): $key_source is deprecated and will be removed in the next major release, please use $key => { 'source' => https://deb.nodesource.com/gpgkey/nodesource.gpg.key } instead.
Warning: Scope(Apt::Key[Add key: 9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280 from Apt::Source nodesource]): $key_source is deprecated and will be removed in the next major release. Please use $source instead.
Error: undefined method `ref' for nil:NilClass on node vagrant-ubuntu-trusty-64.efiling.local
Error: undefined method `ref' for nil:NilClass on node vagrant-ubuntu-trusty-64.efiling.local
我的流浪文件如下所示:
config.vm.provision :shell do |shell|
shell.inline = "mkdir -p /etc/puppet/modules;
puppet module install puppetlabs-apt;
puppet module install puppetlabs/nodejs"
end
config.vm.provision "puppet" do |puppet|
puppet.manifests_path = "manifests"
puppet.manifest_file = "default.pp"
end
这是我的清单文件:
class { 'nodejs': }
接下来的部分是让vagrant运行清单文件,但我相信这些错误阻止了这种情况的发生。
这对我来说都是比较新的,所以寻找关于这个问题的一些指导。
答案 0 :(得分:1)
您应该puppetlabs/nodejs
替换puppetlabs-nodejs
,以便您的Vagrant文件看起来像
config.vm.provision :shell do |shell|
shell.inline = "mkdir -p /etc/puppet/modules;
puppet module install puppetlabs-apt;
puppet module install puppetlabs-nodejs"
end
您使用的是哪个版本的木偶?我不得不在我的ubuntu盒子上升级到更新的版本才能使它工作,我升级到puppet v3.8.4使其工作 - 见下面的日志
==> default: Running provisioner: puppet...
==> default: Running Puppet with default.pp...
==> default: stdin: is not a tty
==> default: Warning: Setting templatedir is deprecated. See http://links.puppetlabs.com/env-settings-deprecations
==> default: (at /usr/lib/ruby/vendor_ruby/puppet/settings.rb:1139:in `issue_deprecation_warning')
==> default: Warning: Config file /etc/puppet/hiera.yaml not found, using Hiera defaults
==> default: Warning: Scope(Apt::Source[nodesource]): $include_src is deprecated and will be removed in the next major release, please use $include => { 'src' => false } instead
==> default: Warning: Scope(Apt::Source[nodesource]): $required_packages is deprecated and will be removed in the next major release, please use package resources instead.
==> default: Warning: Scope(Apt::Source[nodesource]): $key_source is deprecated and will be removed in the next major release, please use $key => { 'source' => https://deb.nodesource.com/gpgkey/nodesource.gpg.key } instead.
==> default: Warning: Scope(Apt::Key[Add key: 9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280 from Apt::Source nodesource]): $key_source is deprecated and will be removed in the next major release. Please use $source instead.
==> default: Notice: Compiled catalog for ubuntu.localdomain in environment production in 0.71 seconds
==> default: Notice: /Stage[main]/Apt/Apt::Setting[conf-update-stamp]/File[/etc/apt/apt.conf.d/15update-stamp]/ensure: defined content as '{md5}0962d70c4ec78bbfa6f3544ae0c41974'
==> default: Notice: /Stage[main]/Apt/File[preferences]/ensure: created
==> default: Notice: /Stage[main]/Nodejs::Repo::Nodesource/Nodejs::Repo::Nodesource::Apt/Apt::Source[nodesource]/Apt::Key[Add key: 9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280 from Apt::Source nodesource]/Apt_key[Add key: 9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280 from Apt::Source nodesource]/ensure: created
==> default: Notice: /Stage[main]/Nodejs::Repo::Nodesource/Nodejs::Repo::Nodesource::Apt/Apt::Source[nodesource]/Apt::Setting[list-nodesource]/File[/etc/apt/sources.list.d/nodesource.list]/ensure: created
==> default: Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: E: The method driver /usr/lib/apt/methods/https could not be found.
==> default: Error: /Stage[main]/Apt::Update/Exec[apt_update]: Failed to call refresh: /usr/bin/apt-get update returned 100 instead of one of [0]
==> default: Error: /Stage[main]/Apt::Update/Exec[apt_update]: /usr/bin/apt-get update returned 100 instead of one of [0]
==> default: Notice: /Stage[main]/Nodejs::Install/Package[nodejs]/ensure: ensure changed 'purged' to 'present'
==> default: Notice: Finished catalog run in 29.83 seconds
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
fhenri@machine:~/project/examples/vagrant/ubuntu$ vagrant ssh
Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-29-virtual x86_64)
* Documentation: https://help.ubuntu.com/
Last login: Thu Nov 19 06:46:10 2015 from 172.16.42.1
vagrant@ubuntu:~$ node -v
v0.6.12
答案 1 :(得分:0)
---这是一种替代方法
这需要一段时间来解决bug,但我发现通过puppet在服务器上安装节点的最佳方法是通过puppet运行手动安装。
我找到了这个repo,并从清单文件中获取了我需要的东西。
class apt_update {
exec { "aptGetUpdate":
command => "sudo apt-get update",
path => ["/bin", "/usr/bin"]
}
}
class othertools {
package { "git":
ensure => latest,
require => Exec["aptGetUpdate"]
}
package { "vim-common":
ensure => latest,
require => Exec["aptGetUpdate"]
}
package { "curl":
ensure => present,
require => Exec["aptGetUpdate"]
}
package { "htop":
ensure => present,
require => Exec["aptGetUpdate"]
}
package { "g++":
ensure => present,
require => Exec["aptGetUpdate"]
}
}
class nodejs {
exec { "git_clone_n":
command => "git clone https://github.com/visionmedia/n.git /home/vagrant/n",
path => ["/bin", "/usr/bin"],
require => [Exec["aptGetUpdate"], Package["git"], Package["curl"], Package["g++"]]
}
exec { "install_n":
command => "make install",
path => ["/bin", "/usr/bin"],
cwd => "/home/vagrant/n",
require => Exec["git_clone_n"]
}
exec { "install_node":
command => "n stable",
path => ["/bin", "/usr/bin", "/usr/local/bin"],
require => [Exec["git_clone_n"], Exec["install_n"]]
}
}
include apt_update
include othertools
include nodejs