Skip to content

Commit c02b0fb

Browse files
committed
Set the certname for PE installer hosts
The only way to set the certname right now for hosts configured with the PE installer is to pre-stage a puppet.conf file with the certname value set. This commit does that for PE installer hosts in order to allow all infrastructure nodes to have their certnames set for them, based on the Bolt target name. If the target name is different from the IP address used to reach the host, then an inventory file should be used.
1 parent 324446c commit c02b0fb

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

plans/action/install.pp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,22 @@
148148
'puppet_enterprise::database_host' => $puppetdb_database_replica_target.peadm::target_name(),
149149
} + $pe_conf_data)
150150

151-
# Upload the pe.conf files to the hosts that need them
152-
peadm::file_content_upload($master_pe_conf, '/tmp/pe.conf', $master_target)
153-
peadm::file_content_upload($puppetdb_database_pe_conf, '/tmp/pe.conf', $puppetdb_database_target)
154-
peadm::file_content_upload($puppetdb_database_replica_pe_conf, '/tmp/pe.conf', $puppetdb_database_replica_target)
151+
# Upload the pe.conf files to the hosts that need them, and ensure correctly
152+
# configured certnames. Right now for these hosts we need to do that by
153+
# staging a puppet.conf file.
154+
['master', 'puppetdb_database', 'puppetdb_database_replica'].each |$var| {
155+
$target = getvar("${var}_target")
156+
$pe_conf = getvar("${var}_pe_conf")
157+
158+
peadm::file_content_upload($pe_conf, '/tmp/pe.conf', $target)
159+
run_task('peadm::mkdir_p_file', $target,
160+
path => '/etc/puppetlabs/puppet/puppet.conf',
161+
content => @("HEREDOC"),
162+
[main]
163+
certname = ${target.peadm::target_name()}
164+
| HEREDOC
165+
)
166+
}
155167

156168
# Download the PE tarball and send it to the nodes that need it
157169
$pe_tarball_name = "puppet-enterprise-${version}-${platform}.tar.gz"

0 commit comments

Comments
 (0)