|
3 | 3 | # This class installs and configures the puppetdb terminus pacakge
|
4 | 4 | #
|
5 | 5 | # Parameters:
|
| 6 | +# ['generate_ssl_certs'] - Generate ssl certs (false to disable) |
6 | 7 | # ['puppet_passenger_port'] - The port for the virtual host
|
7 | 8 | # ['puppet_docroot'] - Apache documnet root
|
8 | 9 | # ['apache_serveradmin'] - The apache server admin
|
|
31 | 32 | # }
|
32 | 33 | #
|
33 | 34 | class puppet::passenger(
|
| 35 | + $generate_ssl_certs = true, |
34 | 36 | $puppet_passenger_port,
|
35 | 37 | $puppet_docroot,
|
36 | 38 | $apache_serveradmin,
|
|
52 | 54 | group => $::puppet::params::puppet_group,
|
53 | 55 | mode => '0750',
|
54 | 56 | }
|
| 57 | + } |
55 | 58 |
|
56 |
| - file{"${puppet_ssldir}/ca": |
57 |
| - ensure => directory, |
58 |
| - owner => $::puppet::params::puppet_user, |
59 |
| - group => $::puppet::params::puppet_group, |
60 |
| - mode => '0770', |
61 |
| - before => Exec['Certificate_Check'], |
62 |
| - } |
| 59 | + if str2bool($generate_ssl_certs) == true { |
| 60 | + |
| 61 | + if $::osfamily == 'redhat' { |
| 62 | + |
| 63 | + file{"${puppet_ssldir}/ca": |
| 64 | + ensure => directory, |
| 65 | + owner => $::puppet::params::puppet_user, |
| 66 | + group => $::puppet::params::puppet_group, |
| 67 | + mode => '0770', |
| 68 | + before => Exec['Certificate_Check'], |
| 69 | + } |
| 70 | + |
| 71 | + file{"${puppet_ssldir}/ca/requests": |
| 72 | + ensure => directory, |
| 73 | + owner => $::puppet::params::puppet_user, |
| 74 | + group => $::puppet::params::puppet_group, |
| 75 | + mode => '0750', |
| 76 | + before => Exec['Certificate_Check'], |
| 77 | + } |
63 | 78 |
|
64 |
| - file{"${puppet_ssldir}/ca/requests": |
65 |
| - ensure => directory, |
66 |
| - owner => $::puppet::params::puppet_user, |
67 |
| - group => $::puppet::params::puppet_group, |
68 |
| - mode => '0750', |
69 |
| - before => Exec['Certificate_Check'], |
70 | 79 | }
|
71 |
| - } |
| 80 | + # first we need to generate the cert |
| 81 | + # Clean the installed certs out ifrst |
| 82 | + $crt_clean_cmd = "puppet cert clean ${certname}" |
| 83 | + # I would have preferred to use puppet cert generate, but it does not |
| 84 | + # return the corret exit code on some versions of puppet |
| 85 | + $crt_gen_cmd = "puppet certificate --ca-location=local --dns_alt_names=$dns_alt_names generate ${certname}" |
| 86 | + # I am using the sign command here b/c AFAICT, the sign command for certificate |
| 87 | + # does not work |
| 88 | + $crt_sign_cmd = "puppet cert sign --allow-dns-alt-names ${certname}" |
| 89 | + # find is required to move the cert into the certs directory which is |
| 90 | + # where it needs to be for puppetdb to find it |
| 91 | + $cert_find_cmd = "puppet certificate --ca-location=local find ${certname}" |
72 | 92 |
|
73 |
| - # first we need to generate the cert |
74 |
| - # Clean the installed certs out ifrst |
75 |
| - $crt_clean_cmd = "puppet cert clean ${certname}" |
76 |
| - # I would have preferred to use puppet cert generate, but it does not |
77 |
| - # return the corret exit code on some versions of puppet |
78 |
| - $crt_gen_cmd = "puppet certificate --ca-location=local --dns_alt_names=$dns_alt_names generate ${certname}" |
79 |
| - # I am using the sign command here b/c AFAICT, the sign command for certificate |
80 |
| - # does not work |
81 |
| - $crt_sign_cmd = "puppet cert sign --allow-dns-alt-names ${certname}" |
82 |
| - # find is required to move the cert into the certs directory which is |
83 |
| - # where it needs to be for puppetdb to find it |
84 |
| - $cert_find_cmd = "puppet certificate --ca-location=local find ${certname}" |
| 93 | + exec { 'Certificate_Check': |
| 94 | + command => "${crt_clean_cmd} ; ${crt_gen_cmd} && ${crt_sign_cmd} && ${cert_find_cmd}", |
| 95 | + unless => "/bin/ls ${puppet_ssldir}/certs/${certname}.pem", |
| 96 | + path => '/usr/bin:/usr/local/bin', |
| 97 | + logoutput => on_failure, |
| 98 | + require => File[$puppet_conf] |
| 99 | + } |
85 | 100 |
|
86 |
| - exec { 'Certificate_Check': |
87 |
| - command => "${crt_clean_cmd} ; ${crt_gen_cmd} && ${crt_sign_cmd} && ${cert_find_cmd}", |
88 |
| - unless => "/bin/ls ${puppet_ssldir}/certs/${certname}.pem", |
89 |
| - path => '/usr/bin:/usr/local/bin', |
90 |
| - logoutput => on_failure, |
91 |
| - require => File[$puppet_conf] |
92 | 101 | }
|
93 | 102 |
|
94 | 103 | file { $puppet_docroot:
|
|
0 commit comments