Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(BKR-1598) Set server hostname #116

Merged
merged 2 commits into from
Jun 17, 2019
Merged
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
27 changes: 9 additions & 18 deletions setup/common/040_ValidateSignCert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@
on(host, "rm -rf '#{ssldir}/*'")
end

step "Set 'server' setting"
hosts.each do |host|
on(host, puppet("config set server #{master.hostname} --section main"))
end

step "Start puppetserver" do
master_opts = {
main: {
dns_alt_names: "puppet,#{hostname},#{fqdn}",
server: fqdn
server: fqdn,
autosign: true
},
}

Expand All @@ -32,23 +38,8 @@
on master, 'puppetserver ca setup'
end
with_puppet_running_on(master, master_opts) do
agents.each do |agent|
next if agent == master

step "Agents: Run agent --test first time to gen CSR"
on agent, puppet("agent --test --server #{master}"), :acceptable_exit_codes => [1]
end

# Sign all waiting agent certs
step "Server: sign all agent certs"
if version_is_less(puppet_version, "5.99")
on master, puppet("cert sign --all"), :acceptable_exit_codes => [0, 24]
else
on master, 'puppetserver ca sign --all', :acceptable_exit_codes => [0, 24]
end

step "Agents: Run agent --test second time to obtain signed cert"
on agents, puppet("agent --test --server #{master}"), :acceptable_exit_codes => [0,2]
step "Agents: Run agent --test with autosigning enabled to get cert"
on agents, puppet("agent --test"), :acceptable_exit_codes => [0,2]
end
end
end