2015-11-19 44 views
0

我试图在使用puppet的新流浪盒上安装节点,但是在运行清单时,我在盒子上得到以下错误。在流浪汉上使用木偶设置nodejs

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': } 

接下来的部分是让无业游民运行清单文件,但我相信这些错误阻止了这种情况的发生。

这对我来说都是比较新的,所以在这个问题上寻找一些指导。

回答

1

则应更换通过puppetlabs/nodejs这样puppetlabs-nodejs您Vagrantfile看起来就像

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箱,使其工作,我升级到木偶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. 
[email protected]:~/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 
[email protected]:~$ node -v 
v0.6.12 
+0

得到同样的问题,我摧毁了箱子并跑了起来。命令行确认已安装新软件包 - ==>默认:/ etc/puppet/modules ==>默认:puppetlabs-nodejs(v0.8.0) –

+0

您正在使用哪个版本的puppet? –

+0

我正在运行3.4.3,将调查更新木偶版本,看看会发生什么,虽然我也发布了另一种解决方案。这可能是也可能不是更好的方法。 –

0

下面---这是一种替代方法

这花了一段时间去解决问题,但我发现通过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