0

On my puppet master I have a site.pp file that defines the content of some certificates like so ...

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

... and I want to write the value of $swift_cert_content to the file /tmp/swift_cert on my puppet master. I have tried this ...

# 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': }

... and I execute this like so ...

# 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

... but the file is empty:

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

What am I doing wrong?

Red Cricket
  • 9,762
  • 21
  • 81
  • 166

1 Answers1

0

I forgot that when one uses puppet apply puppet ignores the site.pp file so I need to do something like this:

# cat /etc/puppetlabs/puppet/manifests/site.pp create_cert_files.pp > runit.pp
# puppet apply runit.pp
Red Cricket
  • 9,762
  • 21
  • 81
  • 166