modify 3rdparty/modules/certregen/manifests/client to set the user and group that...
[mirror/dsa-puppet.git] / 3rdparty / modules / certregen / manifests / client.pp
1 # Distribute the current Puppet CA certificate to client systems.
2 #
3 # To ensure the portability of this code and minimize dependencies, this class uses the `file`
4 # function to distribute the CA certificate instead of having end nodes directly fetch the
5 # certificate themselves. This means that Puppet installations using a master of master/CA server
6 # and compile nodes will need to run Puppet on the compile masters before the CA cert can be
7 # distributed to the agents.
8 class certregen::client(
9   $manage_crl = true
10 ) {
11   file { $::localcacert:
12     ensure  => present,
13     content => file($settings::cacert, $settings::localcacert, '/dev/null'),
14     mode    => '0644',
15     owner   => 'puppet',
16     group   => 'puppet',
17   }
18
19   $pe_build = getvar('::pe_build')
20   $crl_managed_by_pe = ($pe_build and versioncmp($pe_build, '3.7.0') >= 0) and is_classified_with('puppet_enterprise::profile::master')
21   $needs_crl = $manage_crl and !defined(File[$::hostcrl]) and !$crl_managed_by_pe
22
23   if $needs_crl {
24     file { $::hostcrl:
25       ensure  => present,
26       content => file($settings::cacrl, $settings::hostcrl, '/dev/null'),
27       mode    => '0644',
28       owner   => 'puppet',
29       group   => 'puppet',
30     }
31   }
32 }