【发布时间】:2015-04-04 11:31:02
【问题描述】:
我在从 puppet 代理检索文件时遇到问题。我正在运行 puppet master 3.7 版本。这是我的结构:
.
|-- auth.conf
|-- environments
| |-- dev
| | |-- environment.conf
| | |-- manifests
| | | `-- site.pp
| | `-- modules
| | `-- common
| | |-- files
| | | `-- profile
| | |-- manifests
| | | `-- init.pp
| | `-- staticFiles
| | `-- profile
| |-- prod
| | |-- environment.conf
| | |-- manifests
| | | `-- site.pp
| | `-- modules
| | `-- common
| | `-- manifests
| | `-- init.pp
| `-- uat
| |-- environment.conf
| |-- manifests
| | `-- site.pp
| `-- modules
| `-- common
| `-- manifests
| `-- init.pp
|-- etckeeper-commit-post
|-- etckeeper-commit-pre
|-- fileserver.conf
|-- hieradata
|-- hiera.yaml
|-- manifests
|-- modules
|-- nodes
`-- puppet.conf
我的配置是使用 puppet 环境 prod、uat 和 dev。 在开发环境中,我有:
manifest = /etc/puppet/environments/dev/manifests/site.pp
#modulepath = /etc/puppet/environments/dev/modules
modulepath = site:dist:modules:$basemodulepath
在 puppet 客户端配置中,我有: 环境=开发 basemodulepath=/etc/puppet/environments/$environment/modules
这是我的 init 通用 puppet 模块:
file { "/etc/profile":
ensure => "file",
mode => 644,
owner => "root",
group => "root",
require => Package["tree"],
source => "puppet::///common/profile"
}
在节点上出现此错误: 错误:无法应用目录:文件 [/etc/profile] 上的参数源失败:无法在 /etc/puppet/environments/dev/modules/common/manifests/ 使用不透明 URL 'puppet::///common/profile'初始化.pp:13 包装异常: 不能使用不透明的 URL 'puppet::///common/profile'
即使我把源文件放在这样的地方:
"puppet::///common/staticFiles/profile"
"puppet::///common/files/profile"
"puppet::///modules/common/profile"
"puppet::///modules/common/files/profile"
"puppet::///modules/common/staticFiles/profile"
我还是遇到了同样的问题!
有人知道解决这个问题吗? 我真的很想在 /etc/puppet/environments/dev/modules/common/files/ 目录中检索“配置文件”文件。
这里也是我的 puppet master conf 内容:
[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
factpath=$vardir/lib/facter
prerun_command=/etc/puppet/etckeeper-commit-pre
postrun_command=/etc/puppet/etckeeper-commit-post
server = puppetmaster01
certname = puppetmaster01
environment = prod
condir = /etc/puppet
report = true
show_diff = true
trace = true
runinterval=60
environmentpath=$confdir/environments
#basemodulepath = $environmentpath/$environment/modules:/etc/puppet/modules:/usr/share/puppet/modules
[master]
# These are needed when the puppetmaster is run by passenger
# and can safely be removed if webrick is used.
ssl_client_header = SSL_CLIENT_S_DN
ssl_client_verify_header = SSL_CLIENT_VERIFY
certname = puppetmaster01
#modulepath=$confdir/environments/$environment/modules:$confdir/modules
[agent]
report = true
show_diff = true
【问题讨论】:
-
肯定是网址格式有问题。应该是
puppet:///common/profile,第二个:是不需要的。 -
我已经尝试过了,但它不起作用
标签: puppet environment