我有一个ssl cert文件,我希望在使用puppet上传之前将其转换为字符串。以下是我的内容:
class ssl_cert {
$cert='domain.com.crt';
$key='domain.com.key';
file { $urlcert :
ensure => present,
}
file { $key :
ensure => present,
}
exec { 'Use $cert':
path => '/opt/',
require => File[$cert],
command => "/bin/sed -E ':a;N;$!ba;s/\r*\n/\\n/g' $cert",
}
exec { 'Use $key':
path => '/opt/',
require => File[$key],
command => "/bin/sed -E ':a;N;$!ba;s/\r*\n/\\n/g' $key",
}
#Upload ssl cert for vhost
brocadevtm::ssl_server_keys { 'domain.com' :
ensure => present,
basic__note => '',
basic__private => $cert,
basic__public => $key,
}
}
有没有办法传递exec命令(command =>“/ bin / sed -E':a; N; $!ba; s / \ r * \ n / \ n / g'$ cert” ,)一个可以在以后调用并用于值的变量basic__private => ''和basic__public => ''?就像现在一样,这些值只是从上面的变量中获取domain.com.crt和domain.com.key,但我想使用命令的输出而不是文件。