puppet 可以在节点上执行,但不能从模块传输文件。
Ubuntu 14.04 服务器 Puppet 3.8.4
已经尝试过:
- 使文件世界可读
- 禁用固件
- 在模块目录中创建facter.d
在主人:
/etc/puppet/puppet.conf
[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
modulepath = /etc/puppet/modules
factpath=$vardir/lib/facter
/etc/puppet/manifests/site.pp
node 'gitlab.domain' {
include ssh
}
/etc/puppet/modules/ssh/manifests/init.pp
class ssh {
exec { 'apt-update':
command => 'apt-get update',
path => ['/usr/bin', '/bin', '/sbin'],
logoutput => on_failure,
}
# ensure openssh installed
package { 'openssh-server':
ensure => installed,
require => Exec['apt-update'],
}
# make sure ssh keeps running
service { 'ssh':
ensure => 'running',
enable => true,
require => Package['openssh-server'],
}
# copy sshd_config
file { '/etc/ssh/sshd_config':
ensure => 'present',
notify => Service['ssh'],
source => 'puppet:///modules/ssh/config/sshd_config',
owner => 'root',
group => 'root',
mode => '0600',
require => Package['openssh-server'],
}
}
在主人:
ls -la /etc/puppet/modules/ssh/config
-rw-r--r-- 1 puppet root 356 Nov 27 11:43 sshd_config
在节点上:
sudo puppet agent -t -v
[....]
Info: Applying configuration version ...
Notice: /Stage[main]/Ssh/Exec[apt-update]/returns: executed successfully
Error: /Stage[main]/Ssh/File[/etc/ssh/sshd_config]: Could not evaluate: Could not retrieve information from environment production source(s) puppet:///modules/ssh/config/sshd_config
问题是由于
/etc/puppet/environments/production/modules/ssh/files/config/sshd_config
或/etc/puppet/modules/ssh/files/config/sshd_config
不存在而引起的