diff --git a/setup/common/040_ValidateSignCert.rb b/setup/common/040_ValidateSignCert.rb index ae5ae2de..541df005 100644 --- a/setup/common/040_ValidateSignCert.rb +++ b/setup/common/040_ValidateSignCert.rb @@ -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 }, } @@ -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