Skip to content

Commit

Permalink
setting env vars in #618 do not work on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
lbetz committed Oct 6, 2020
1 parent a144d9e commit 687a8e7
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions manifests/feature/api.pp
Original file line number Diff line number Diff line change
Expand Up @@ -307,27 +307,30 @@
$_cmd_pki_get_cert = $cmd_pki_get_cert
}

$_env = $::kernel ? {
'windows' => undef,
default => ["ICINGA2_USER=${user}", "ICINGA2_GROUP=${group}"],
}

Exec {
notify => Class['::icinga2::service'],
environment => $_env,
notify => Class['::icinga2::service'],
}

exec { 'icinga2 pki create key':
command => "\"${icinga2_bin}\" pki new-cert --cn ${node_name} --key ${_ssl_key_path} --cert ${_ssl_cert_path}",
environment => ["ICINGA2_USER=${user}", "ICINGA2_GROUP=${group}"],
creates => $_ssl_key_path,
command => "\"${icinga2_bin}\" pki new-cert --cn ${node_name} --key ${_ssl_key_path} --cert ${_ssl_cert_path}",
creates => $_ssl_key_path,
}

-> exec { 'icinga2 pki get trusted-cert':
path => $::path,
command => $_cmd_pki_get_cert,
environment => ["ICINGA2_USER=${user}", "ICINGA2_GROUP=${group}"],
creates => $trusted_cert,
path => $::path,
command => $_cmd_pki_get_cert,
creates => $trusted_cert,
}

-> exec { 'icinga2 pki request':
command => "\"${icinga2_bin}\" pki request --host ${ca_host} --port ${ca_port} --ca ${_ssl_cacert_path} --key ${_ssl_key_path} --cert ${_ssl_cert_path} --trustedcert ${trusted_cert} --ticket ${_ticket_id}", # lint:ignore:140chars
environment => ["ICINGA2_USER=${user}", "ICINGA2_GROUP=${group}"],
creates => $_ssl_cacert_path,
command => "\"${icinga2_bin}\" pki request --host ${ca_host} --port ${ca_port} --ca ${_ssl_cacert_path} --key ${_ssl_key_path} --cert ${_ssl_cert_path} --trustedcert ${trusted_cert} --ticket ${_ticket_id}", # lint:ignore:140chars
creates => $_ssl_cacert_path,
}
} # icinga2
} # case pki
Expand Down

0 comments on commit 687a8e7

Please sign in to comment.