Skip to content
This repository has been archived by the owner on Jul 9, 2020. It is now read-only.

Refs #23210 - Provision PuppetCA-Token on Host #475

Merged
merged 1 commit into from
Sep 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions provisioning_templates/snippet/csr_attributes.yaml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<%#
kind: snippet
name: csr_attributes.yaml
model: ProvisioningTemplate
snippet: true
%>
---
custom_attributes:
1.2.840.113549.1.9.7: "<%= @host.puppetca_token.value %>"
11 changes: 11 additions & 0 deletions provisioning_templates/snippet/puppet_setup.erb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ cat > <%= etc_path %>/puppet.conf << EOF
EOF
<% end -%>

<% if @host.puppetca_token.present? -%>
<% if os_family == 'Windows' -%>
$csr_attributes = @("<%= snippet 'csr_attributes.yaml' %>".Replace("`n","`r`n"))
Out-File -FilePath <%= etc_path %>\csr_attributes.yaml -InputObject $csr_attributes
<% else -%>
cat > <%= etc_path %>/csr_attributes.yaml << EOF
<%= snippet 'csr_attributes.yaml' %>
EOF
<% end -%>
<% end -%>

<% if os_family == 'Redhat' -%>
<% if os_major > 6 -%>
puppet_unit=puppet
Expand Down