Puppet agent 无法从 master 部署模块

Puppet agent can't be deployed module from master

我刚开始学习 Puppet,对这个世界来说真的很陌生。我在我的两个学习虚拟机上使用 puppet 2.7.26 -- 人偶大师 192.168.160.131 eisen-suse11 192.168.160.129 按照turial,我已经成功地将节点“eisen-suse11”签署给puppet-master--

puppet-master:/etc/puppet/modules/motd/manifests # puppet cert --list --all
+ "eisen-suse11"         (A0:7F:E2:77:30:9A:96:E3:79:FD:F7:1E:59:35:5B:1E)
+ "puppet-master"        (38:90:B5:8A:68:8A:A7:44:8A:2F:07:D3:F3:AC:E8:80) (alt names: "DNS:puppet", "DNS:puppet-master", "DNS:puppet-master.suse11", "DNS:puppet.suse11")
+ "puppet-master.suse11" (5D:9E:A4:D9:0C:5F:69:07:FA:55:13:C3:38:6D:9B:26)

然后照着书上的写,我写了一个模块——motd——应该放一个文件到客户端节点——

puppet-master:/etc/puppet/modules/motd/manifests # cat init.pp
class motd{
      package{ 'setup':
      ensure => present,
  }
  file{ '/etc/motd':
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0644',
        source  => "puppet://$puppetserver/modules/motd/etc/motd",
        require => Package['setup']
    }
}
puppet-master:/etc/puppet/modules/motd/manifests # cat site.pp
$puppetserver='puppet-master.suse11'
node 'eisen-suse11'{
    include motd
}

但是当我在客户端节点 -- eisen-suse11 上测试“puppet 代理 --test --trace” --- 一切都很安静 --

eisen-suse11:~ # puppet agent --test --trace
info: Caching catalog for eisen-suse11
info: Applying configuration version '1633779962'
notice: Finished catalog run in 0.01 seconds

    eisen-suse11:~ # ls /etc/motd
    ls: cannot access /etc/motd: No such file or directory

   That "/etc/motd" is not copied from puppet-master -- 
   Does anyone can help? Any idea would be appreciated.  

RGS 艾森

问题是您的节点接收到一个空目录,这是因为您将 site.pp 文件放在了错误的位置。 Puppet 不会在模块中找到它。自从我为 Puppet 2 编写代码以来已经有很长时间了(我坚持使用该版本的时间比健康时长得多),但我记得,该文件的正确目录是 /etc/puppet/manifests.

但是,正如我在评论中所写的那样,Puppet 2 已经完全过时并且已经过时了。扔掉它,也扔掉任何教它的书。我能想到学习这个版本的 Puppet 的唯一原因是你有一个你有义务维护的现有遗留基础设施,但如果你在 2021 年面临这样的 Puppet 代码库,那么最好从头开始重写对于木偶 7。