在 Puppet 清单中使用源时出错

Error using source in Puppet manifest

我正在尝试更改 Puppet 代理中的文件,并且我已经编写了以下代码。

modules/
├── helloworld
│   └── manifests
│       ├── init.pp
│       └── motd.pp
└── ssh
    ├── manifests
    |    └── init.pp
    └── ssh_config

我的 Puppet 清单代码:

# modules/ssh/manifests/init.pp 
class ssh {
  package { 'openssl':
    ensure => present,
    before => File['/etc/ssh/sshd_config'],
  }

  file {'ssh_config':
    ensure => file,
    path   => '/etc/ssh/sshd_config',
    mode   => "600",
    source => "puppet:///modules/ssh/ssh_config",
  }

  service {'sshd':
    ensure    => running, 
    enable    => true,
    subscribe => File['/etc/ssh/sshd_config'],
  }
}

下面是主要清单的代码:

# manifests/site.pp 
node default {
  class { 'ssh': }
}

以下是我收到的错误:

Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for dheera.asicdesigners.com
Info: Applying configuration version '1478497316'
Error: /Stage[main]/Ssh/File[ssh_config]: Could not evaluate: Could not retrieve information from environment production        source(s)       
puppet:///modules/ssh/ssh_config
Notice: /Stage[main]/Ssh/Service[sshd]: Dependency File[ssh_config] has failures: true
Warning: /Stage[main]/Ssh/Service[sshd]: Skipping because of failed dependencies
Notice: Applied catalog in 0.21 seconds

您的 ssh_config 文件位置需要位于模块的 files 目录中,以便像您正在做的那样与 source 属性中的 Puppet URI 一起使用。

modules/
├── helloworld
│   └── manifests
│       ├── init.pp
│       └── motd.pp
└── ssh
    ├── manifests
    |    └── init.pp
    └── files
         ├── ssh_config

此外,您的 package 资源可能是 openssh 而不是 openssl