Puppet 在傀儡清单中使用源时出错

Puppet 在傀儡清单中使用源时出错,puppet,Puppet,我正在尝试更改puppet Agent中的一个文件,我已经编写了以下代码 modules/ ├── helloworld │ └── manifests │ ├── init.pp │ └── motd.pp └── ssh ├── manifests | └── init.pp └── ssh_config 我的傀儡清单代码: # modules/ssh/manifests/init.pp class ssh { package

我正在尝试更改puppet Agent中的一个文件,我已经编写了以下代码

modules/
├── helloworld
│   └── manifests
│       ├── init.pp
│       └── motd.pp
└── ssh
    ├── manifests
    |    └── init.pp
    └── ssh_config
我的傀儡清单代码:

# 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\u config
文件位置需要位于模块的
files
目录中,以便与
source
属性中的Puppet URI一起使用

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

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

,非常感谢它的工作。以上就是我的例子trying@sagar很高兴听到。如果有帮助,请接受我的回答。