Sha256: 7145683ed4a03cf4421f650a711c87daea1ddca392b75c50473ce59036ea919a

Contents?: true

Size: 1.3 KB

Versions: 5

Compression:

Stored size: 1.3 KB

Contents

test_name 'Validate Sign Cert' do
  need_to_run = false
  hosts.each do |host|
    need_to_run ||= !host['use_existing_container']
  end
  skip_test 'No new hosts to create, skipping' unless need_to_run
  skip_test 'not testing with puppetserver' unless @options['is_puppetserver']
  hostname = on(master, 'facter hostname').stdout.strip
  fqdn = on(master, 'facter fqdn').stdout.strip

  step 'Ensure puppet is stopped'
  on(master, puppet('resource', 'service', master['puppetservice'], 'ensure=stopped'))

  step 'Clear SSL on all hosts'
  hosts.each do |host|
    ssldir = on(host, puppet('agent --configprint ssldir')).stdout.chomp
    # preserve permissions for master's ssldir so puppetserver can read it
    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,
        autosign: true,
      },
    }

    on(master, 'puppetserver ca setup')
    with_puppet_running_on(master, master_opts) do
      step 'Agents: Run agent --test with autosigning enabled to get cert'
      on(agents, puppet('agent --test'), acceptable_exit_codes: [0, 2])
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
beaker-puppet-4.1.1 setup/common/040_ValidateSignCert.rb
beaker-puppet-4.1.0 setup/common/040_ValidateSignCert.rb
beaker-puppet-4.0.0 setup/common/040_ValidateSignCert.rb
beaker-puppet-3.0.1 setup/common/040_ValidateSignCert.rb
beaker-puppet-3.0.0 setup/common/040_ValidateSignCert.rb