File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 11
11
12
12
require 'puppet'
13
13
require 'open3'
14
+ require 'facter'
14
15
15
16
Puppet . initialize_settings
16
17
18
+ def pe_master?
19
+ !Facter . value ( 'pe_build' ) . nil?
20
+ end
21
+
17
22
# This task only works when running against your Puppet CA server, so let's check for that.
18
- # In Puppetserver, that means that the bootstrap.cfg file contains 'certificate-authority-service'.
19
- bootstrap_cfg = '/etc/puppetlabs/puppetserver/bootstrap.cfg'
20
- if !File . exist? ( bootstrap_cfg ) || File . readlines ( bootstrap_cfg ) . grep ( %r{^[^#].+certificate-authority-service$} ) . empty?
21
- puts 'This task can only be run on your certificate authority Puppet master (MoM)'
23
+ # In Puppetserver, that means the configs contain 'certificate-authority-service', uncommented.
24
+ # The puppetserver config file differs between PE and open-source puppetserver.
25
+ ca_cfg = pe_master? ? '/etc/puppetlabs/puppetserver/bootstrap.cfg' : '/etc/puppetlabs/puppetserver/services.d/ca.cfg'
26
+
27
+ if !File . exist? ( ca_cfg ) || File . readlines ( ca_cfg ) . grep ( %r{^[^#].+certificate-authority-service$} ) . empty?
28
+ puts 'This task can only be run on your certificate authority Puppetserver'
22
29
exit 1
23
30
end
24
31
You can’t perform that action at this time.
0 commit comments