我有 nex puppet 模块来管理limits.conf:
限制.pp
define limits::limits(
$user = undef,
$type = ['hard','soft'],
$item = ['core','data','fsize','memlock','nofile','rss','stack','cpu','nproc','as','maxlogins','priority','locks','sigpending','msgqueue','nice','rtprio'],
$value =[],
)
{
include limits::params
if $user == undef{
fail ('Error:Parameter user its necesary')
}
case $type {
'hard': {}
'soft': {}
default: {
fail("The parameter type must be hard or soft")
}
}
case $item {'core','data','fsize','memlock','nofile','rss','stack','cpu','nproc','as','maxlogins','priority','locks','sigpending','msgqueue','nice','rtprio':{}
default: {
fail("The parameter item is incorrect")
}
}
if $value == undef {
fail ('Error:Parameter value its necesary')
}
file {"/etc/security/limits.d/${title}.conf":
ensure => present,
owner => 'root',
group => 'root',
mode => 0644,
content => template('limits/limits.erb'),
}
}
当我尝试使用我的 puppetmaster 进行证明时,我创建了一个 puppet.yaml 来传递参数,并使用以下代码:
# Classes to be applied to this node
classes:
- '::limits'
# Parameters
limits::limits:
'prove':
limits::user: 'prove'
limits::type: 'hard'
limits::item: 'core'
limits::value: '23'
当我执行时,收到下一条消息错误:
puppet agent --test --verbose --debug --trace
debug: Puppet::Type::User::ProviderUser_role_add: file roleadd does not exist
debug: Puppet::Type::User::ProviderDirectoryservice: file /usr/bin/dscl does not exist
debug: Puppet::Type::User::ProviderPw: file pw does not exist
debug: Failed to load library 'ldap' for feature 'ldap'
debug: Puppet::Type::User::ProviderLdap: feature ldap is missing
debug: Failed to load library 'rubygems' for feature 'rubygems'
debug: Failed to load library 'selinux' for feature 'selinux'
debug: /File[/var/lib/puppet/ssl/public_keys]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/state/graphs]: Autorequiring File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/public_keys/puppet.client.com.pem]: Autorequiring File[/var/lib/puppet/ssl/public_keys]
debug: /File[/var/lib/puppet/client_yaml]: Autorequiring File[/var/lib/puppet]
debug: /File[/etc/puppet/puppet.conf]: Autorequiring File[/etc/puppet]
debug: /File[/var/lib/puppet/client_data]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/state/resources.txt]: Autorequiring File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/state/state.yaml]: Autorequiring File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/ssl/private_keys]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/certs/puppet.client.com.pem]: Autorequiring File[/var/lib/puppet/ssl/certs]
debug: /File[/var/lib/puppet/state/classes.txt]: Autorequiring File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/ssl/certificate_requests]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/run/puppet/agent.pid]: Autorequiring File[/var/run/puppet]
debug: /File[/var/lib/puppet/state/last_run_report.yaml]: Autorequiring File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/ssl/private_keys/puppet.client.com.pem]: Autorequiring File[/var/lib/puppet/ssl/private_keys]
debug: /File[/var/lib/puppet/ssl/private]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/crl.pem]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/certs/ca.pem]: Autorequiring File[/var/lib/puppet/ssl/certs]
debug: /File[/var/lib/puppet/clientbucket]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/state]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/state/last_run_summary.yaml]: Autorequiring File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/ssl/certs]: Autorequiring File[/var/lib/puppet/ssl]
debug: Finishing transaction 70127455075880
debug: /File[/var/lib/puppet/ssl]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/public_keys]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/certs/ca.pem]: Autorequiring File[/var/lib/puppet/ssl/certs]
debug: /File[/var/lib/puppet/ssl/private]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/certs]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/state]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/private_keys/puppet.client.com.pem]: Autorequiring File[/var/lib/puppet/ssl/private_keys]
debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/certificate_requests]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/public_keys/puppet.client.com.pem]: Autorequiring File[/var/lib/puppet/ssl/public_keys]
debug: /File[/var/lib/puppet/ssl/private_keys]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/crl.pem]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/certs/puppet.client.com.pem]: Autorequiring File[/var/lib/puppet/ssl/certs]
debug: Finishing transaction 70127453290940
debug: Using cached certificate for ca
debug: Using cached certificate for puppet.client.com
debug: Finishing transaction 70127452773620
debug: Loaded state in 0.00 seconds
debug: Executing '/etc/puppet/etckeeper-commit-pre'
debug: catalog supports formats: b64_zlib_yaml dot pson raw yaml; using pson
debug: Using cached certificate for ca
debug: Using cached certificate for puppet.client.com
debug: Using cached certificate_revocation_list for ca
/usr/lib/ruby/1.8/puppet/indirector/rest.rb:162:in `is_http_200?'
/usr/lib/ruby/1.8/puppet/indirector/rest.rb:95:in `find'
/usr/lib/ruby/1.8/puppet/indirector/indirection.rb:196:in `find'
/usr/lib/ruby/1.8/puppet/configurer.rb:239:in `retrieve_new_catalog'
/usr/lib/ruby/1.8/puppet/util.rb:477:in `thinmark'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/lib/ruby/1.8/puppet/util.rb:476:in `thinmark'
/usr/lib/ruby/1.8/puppet/configurer.rb:238:in `retrieve_new_catalog'
/usr/lib/ruby/1.8/puppet/configurer.rb:86:in `retrieve_catalog'
/usr/lib/ruby/1.8/puppet/configurer.rb:112:in `retrieve_and_apply_catalog'
/usr/lib/ruby/1.8/puppet/configurer.rb:151:in `run'
/usr/lib/ruby/1.8/puppet/agent.rb:44:in `run'
/usr/lib/ruby/1.8/puppet/agent/locker.rb:21:in `lock'
/usr/lib/ruby/1.8/puppet/agent.rb:44:in `run'
/usr/lib/ruby/1.8/sync.rb:230:in `synchronize'
/usr/lib/ruby/1.8/puppet/agent.rb:44:in `run'
/usr/lib/ruby/1.8/puppet/agent.rb:108:in `with_client'
/usr/lib/ruby/1.8/puppet/agent.rb:42:in `run'
/usr/lib/ruby/1.8/puppet/application.rb:172:in `call'
/usr/lib/ruby/1.8/puppet/application.rb:172:in `controlled_run'
/usr/lib/ruby/1.8/puppet/agent.rb:40:in `run'
/usr/lib/ruby/1.8/puppet/application/agent.rb:336:in `onetime'
/usr/lib/ruby/1.8/puppet/application/agent.rb:310:in `run_command'
/usr/lib/ruby/1.8/puppet/application.rb:309:in `run'
/usr/lib/ruby/1.8/puppet/application.rb:413:in `hook'
/usr/lib/ruby/1.8/puppet/application.rb:309:in `run'
/usr/lib/ruby/1.8/puppet/application.rb:404:in `exit_on_fail'
/usr/lib/ruby/1.8/puppet/application.rb:309:in `run'
/usr/lib/ruby/1.8/puppet/util/command_line.rb:69:in `execute'
/usr/bin/puppet:4
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Hiera type mismatch: expected Array and got NilClass
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run
debug: Executing '/etc/puppet/etckeeper-commit-post'
debug: report supports formats: b64_zlib_yaml pson raw yaml; using pson
当然这是一个问题,我不知道将值传递给 puppet.yaml,但我不知道错误。有人能帮我吗?谢谢