Add puppetlabs/certregen module
[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   }
16
17   $pe_build = getvar('::pe_build')
18   $crl_managed_by_pe = ($pe_build and versioncmp($pe_build, '3.7.0') >= 0) and is_classified_with('puppet_enterprise::profile::master')
19   $needs_crl = $manage_crl and !defined(File[$::hostcrl]) and !$crl_managed_by_pe
20
21   if $needs_crl {
22     file { $::hostcrl:
23       ensure  => present,
24       content => file($settings::cacrl, $settings::hostcrl, '/dev/null'),
25       mode    => '0644',
26     }
27   }
28 }