Skip to content

Commit 7837a5c

Browse files
committed
P:puppet::server: Deploy sync SSH keys to other hosts
1 parent 6ae3516 commit 7837a5c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

modules/profile/manifests/puppet/server.pp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
) {
88
include profile::puppet::common
99

10+
$primary_host = $profile::puppet::agent::ca_server
11+
$is_primary = $primary_host == $facts['networking']['fqdn']
12+
1013
$termini_package = debian::codename() ? {
1114
'bullseye' => 'puppetdb-termini',
1215
default => 'puppet-terminus-puppetdb',
@@ -249,6 +252,19 @@
249252

250253
ssh::client::user_key { 'puppet-sync': }
251254

255+
if $facts['ssh_local_keys'] and $facts['ssh_local_keys']['puppet-sync'] {
256+
$key = $facts['ssh_local_keys']['puppet-sync']
257+
@@ssh_authorized_key { "puppet-sync-${facts['networking']['fqdn']}":
258+
user => 'root',
259+
type => $key.split(' ')[0],
260+
key => $key.split(' ')[1],
261+
options => ['restrict'],
262+
tag => 'profile::puppet::server::puppet_sync',
263+
}
264+
}
265+
266+
Ssh_authorized_key <<| tag == 'profile::puppet::server::puppet_sync' |>>
267+
252268
# Expose SSH keys so users can verify them
253269
file { '/srv/www':
254270
ensure => directory,

0 commit comments

Comments
 (0)