Puppet Class: psick::puppet::pdk

Defined in:
manifests/puppet/pdk.pp

Overview

Parameters:

  • ensure (Psick::Ensure) (defaults to: 'present')
  • auto_prereq (Boolean) (defaults to: $::psick::auto_prereq)


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'manifests/puppet/pdk.pp', line 2

class psick::puppet::pdk (
  Psick::Ensure $ensure = 'present',
  #  String $dist,
  #  String $extract_command,
  Boolean         $auto_prereq              = $::psick::auto_prereq,
) {

  if $auto_prereq {
    include ::psick::ruby::buildgems
  }

  # Waiting for pdk repo
  #  package { 'pdk':
  #   ensure => $ensure,
  #}
  $dist = $facts['os']['family'] ? {
    'RedHat' => 'el',
    'SuSE'   => 'sles',
    'Debian' => 'ubuntu',
  }
  $arch = $facts['os']['family'] ? {
    'Debian' => 'amd64',
    default  => 'x86_64',
  }
  $url = "https://pm.puppetlabs.com/cgi-bin/pdk_download.cgi?dist=${dist}&rel=${facts['os']['release']['major']}&arch=${arch}&ver=latest"
  $command = $facts['os']['family'] ? {
    'RedHat' => "rpm -Uvh '${url}'",
    'SuSE'   => "rpm -Uvh '${url}'",
    'Debian' => "wget '${url}' -O pdk.deb && dpkg --install pdk.deb",
  }
  $unless_command = $facts['os']['family'] ? {
    'RedHat' => 'rpm -qi pdk',
    'SuSE'   => 'rpm -qi pdk',
    'Debian' => 'apt show pdk',
  }

  exec { 'Install PDK':
    command => $command,
    unless  => $unless_command,
  }
}