Skip to content

Commit 4d5a801

Browse files
committed
Add template for SSH CA known hosts file
1 parent b96bcac commit 4d5a801

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

manifests/plugin/remote_execution/script.pp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,14 @@
9595
}
9696

9797
if $ssh_host_ca_public_keys_file {
98-
$ca_keys_content = file($ssh_host_ca_public_keys_file)
99-
$ca_keys_lines = split($ca_keys_content, "\n").filter |$line| { $line =~ /\S/ }
100-
$ca_known_hosts_content = $ca_keys_lines.map |$line| { "@cert-authority * ${line}" }.join("\n")
98+
$ca_keys = split(file($ssh_host_ca_public_keys_file), "\n")
10199

102100
file { $ssh_ca_known_hosts_file:
103101
ensure => file,
104102
owner => $foreman_proxy::user,
105103
group => $foreman_proxy::group,
106104
mode => '0600',
107-
content => "${ca_known_hosts_content}\n",
105+
content => epp('foreman_proxy/plugin/ssh_ca_known_hosts.epp', { 'ca_keys' => $ca_keys }),
108106
}
109107
} else {
110108
file { $ssh_ca_known_hosts_file:
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<%- | Array[String] $ca_keys | -%>
2+
<%- $ca_keys.filter |$line| { $line =~ /\S/ }.each |$line| { -%>
3+
@cert-authority * <%= $line %>
4+
<%- } -%>

0 commit comments

Comments
 (0)