Puppet Class: psick::chruby

Defined in:
manifests/chruby.pp

Summary

This psick profile manages chruby.

Overview

psick::chruby

Examples:

Include it to install chruby

include psick::chruby

Include in PSICK via hiera (yaml)

psick::profiles::linux_classes:
  chruby: psick::chruby

Set no-noop mode and enforce changes even if noop is set for the agent

psick::chruby::no_noop: true

Parameters:

  • manage (Boolean) (defaults to: $psick::manage)

    If to actually manage any resource in this profile or not

  • auto_prereq (Boolean) (defaults to: $psick::auto_prereq)

    If to automatically install eventual dependencies. Set to false if you have problems with duplicated resources, being sure that you provide the needed prerequistes.

  • noop_manage (Boolean) (defaults to: $psick::noop_manage)

    If to use the noop() function for all the resources provided by this class. If this is true the noop function is called with $noop_value argument. This overrides any other noop setting (either set on client’s puppet.conf or by noop() function in main psick class). Default from psick class.

  • noop_value (Boolean) (defaults to: $psick::noop_value)

    The value to pass to noop() function if noop_manage is true. It applies to all the resources (and classes) declared in this class If true: noop metaparamenter is set to true, resources are not applied If false: noop metaparameter is set to false, and any eventual noop setting is overridden: resources are always applied. Default from psick class.

  • ensure (Psick::Ensure) (defaults to: 'present')
  • version (String) (defaults to: '0.3.9')
  • default_ruby_version (String) (defaults to: '2.4.3')
  • ruby_prefix (StdLib::AbsolutePath) (defaults to: '/opt/rubies')
  • user (Optional[String]) (defaults to: undef)
  • group (Optional[String]) (defaults to: undef)
  • sources_root (Optional[String]) (defaults to: undef)
  • download_root (Optional[String]) (defaults to: undef)


30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'manifests/chruby.pp', line 30

class psick::chruby (
  Psick::Ensure $ensure             = 'present',
  String $version                   = '0.3.9',
  String $default_ruby_version      = '2.4.3',
  StdLib::AbsolutePath $ruby_prefix = '/opt/rubies',
  Optional[String] $user            = undef,
  Optional[String] $group           = undef,
  Optional[String] $sources_root    = undef,
  Optional[String] $download_root   = undef,

  Boolean         $manage           = $psick::manage,
  Boolean         $auto_prereq      = $psick::auto_prereq,
  Boolean         $noop_manage      = $psick::noop_manage,
  Boolean         $noop_value       = $psick::noop_value,

) {
  # We declare resources only if $manage = true
  if $manage {
    if $noop_manage {
      noop($noop_value)
    }

    $sources_dest = $sources_root ? {
      undef   => "${ruby_prefix}/sources",
      default => $sources_root
    }
    $download_dest = $download_root ? {
      undef   => "${ruby_prefix}/downloads",
      default => $download_root
    }
    psick::netinstall { "chruby-v${version}.tar.gz":
      destination_dir => $sources_dest,
      url             => "https://github.com/postmodern/chruby/archive/v${version}.tar.gz",
      extract_command => 'tar -zxf',
      owner           => $user,
      group           => $group,
      creates         => "${sources_dest}/chruby-${version}",
      before          => Exec['install chruby'],
    }

    exec { 'install chruby':
      cwd     => "${sources_dest}/chruby-${version}",
      command => 'make install',
      creates => '/usr/local/share/chruby',
      path    => ['/sbin', '/usr/sbin', '/bin', '/usr/bin'],
    }

    file { '/etc/profile.d/chruby.sh':
      ensure  => 'file',
      content => '. "/usr/local/share/chruby/chruby.sh"',
      require => Exec['install chruby'],
    }
  }
}