0

在我的 puppet master 上,我有一个site.pp文件,它定义了一些证书的内容,如下所示......

$swift_cert_content = '
-----BEGIN CERTIFICATE-----
blhablhadfblhablah...
-----END RSA PRIVATE KEY-----
'

...我想将 的值写入我的 puppet master$swift_cert_content的文件中。/tmp/swift_cert我试过这个...

# cat create_cert_files.pp 
class create_cert_files (
  $swift_cert_content = $::swift_cert_content,
) {
  file { '/tmp/swift_cert':
    ensure => "file",
    content => $swift_cert_content,
  } 
}

class { 'create_cert_files': }

...我像这样执行这个...

# puppet apply create_cert_files.pp 
Notice: Compiled catalog for osc-ppt-001.example.com in environment production in 0.16 seconds
Notice: /Stage[main]/Create_cert_files/File[/tmp/swift_cert]/ensure: created
Notice: Finished catalog run in 0.31 seconds

...但文件为空:

# ls -l /tmp/swift_cert 
-rw-r--r-- 1 root root 0 Aug 26 14:55 /tmp/swift_cert

我究竟做错了什么?

4

1 回答 1

0

我忘记了当使用puppet applypuppet 时会忽略 site.pp 文件,所以我需要执行以下操作:

# cat /etc/puppetlabs/puppet/manifests/site.pp create_cert_files.pp > runit.pp
# puppet apply runit.pp
于 2015-08-26T23:02:53.330 回答