我正在尝试更改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
答案 0 :(得分:2)
您的ssh_config
文件位置必须位于模块的files
目录中,才能与source
属性中的Puppet URI一起使用。
modules/
├── helloworld
│ └── manifests
│ ├── init.pp
│ └── motd.pp
└── ssh
├── manifests
| └── init.pp
└── files
├── ssh_config
此外,您可能认为自己的package
资源为openssh
而非openssl
。