Method: Beaker::DSL::InstallUtils#install_puppet

Defined in:
lib/beaker/dsl/install_utils.rb

#install_puppet(opts = {}) ⇒ Object

Note:

This will attempt to add a repository for apt.puppetlabs.com on Debian, Ubuntu, or Cumulus machines, or yum.puppetlabs.com on EL or Fedora machines, then install the package ‘puppet’.

Install FOSS based upon host configuration and options

Examples:

will install puppet 3.6.1 from native puppetlabs provided packages wherever possible and will fail over to gem installation when impossible

install_puppet({
  :version          => '3.6.1',
  :facter_version   => '2.0.1',
  :hiera_version    => '1.3.3',
  :default_action   => 'gem_install',

 })

Will install latest packages on Enterprise Linux and Debian based distros and fail hard on all othere platforms.

install_puppet()

Parameters:

  • opts (Hash{Symbol=>String}) (defaults to: {})

Options Hash (opts):

  • :version (String)

    Version of puppet to download

  • :mac_download_url (String)

    Url to download msi pattern of %url%/puppet-%version%.msi

  • :win_download_url (String)

    Url to download dmg pattern of %url%/(puppet|hiera|facter)-%version%.msi

Returns:

  • nil

Raises:

  • (StandardError)

    When encountering an unsupported platform by default, or if gem cannot be found when default_action => ‘gem_install’

  • (FailTest)

    When error occurs during the actual installation process



685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
# File 'lib/beaker/dsl/install_utils.rb', line 685

def install_puppet(opts = {})
  default_download_url = 'http://downloads.puppetlabs.com'
  opts = {:win_download_url => "#{default_download_url}/windows",
          :mac_download_url => "#{default_download_url}/mac"}.merge(opts)
  hosts.each do |host|
    if host['platform'] =~ /el-(5|6|7)/
      relver = $1
      install_puppet_from_rpm host, opts.merge(:release => relver, :family => 'el')
    elsif host['platform'] =~ /fedora-(\d+)/
      relver = $1
      install_puppet_from_rpm host, opts.merge(:release => relver, :family => 'fedora')
    elsif host['platform'] =~ /(ubuntu|debian|cumulus)/
      install_puppet_from_deb host, opts
    elsif host['platform'] =~ /windows/
      relver = opts[:version]
      install_puppet_from_msi host, opts
    elsif host['platform'] =~ /osx/
      install_puppet_from_dmg host, opts
    else
      if opts[:default_action] == 'gem_install'
        install_puppet_from_gem host, opts
      else
        raise "install_puppet() called for unsupported platform '#{host['platform']}' on '#{host.name}'"
      end
    end

    # Certain install paths may not create the config dirs/files needed
    on host, "mkdir -p #{host['puppetpath']}" unless host[:type] =~ /aio/
    on host, "echo '' >> #{host.puppet['hiera_config']}"
  end
  nil
end