Defined Type: tp::install::source

Defined in:
manifests/install/source.pp

Overview

This define installs the application (app) set in the given title git cloning the relevant source and eventually building or installing elements from it. The define takes care of:

  • Cloning the app git repo from the Internet (git_source setting is used)

  • Eventually building sources

  • Eventually installing the app’s binary to destination path

  • Eventually create and manage the relevant service

This define is declared from the tp::install define when $install_method is set to ‘source’ either via a params entry or directly in tinydata settings.

Examples:

Install an app from a release package. (Tinydaya must be present)

tp::install { 'prometheus':
  install_method => 'release',
}

Parameters:

  • ensure (Variant[Boolean,String]) (defaults to: present)

    If to install (present), remove (absent), ensure is at a specific ref (tag, branch or ) (1.1.1). Note: version can also be specified via the version parameter. If that’s set that takes prececendence over this one.

  • on_missing_data (Tp::Fail) (defaults to: pick(getvar('tp::on_missing_data'),'notify'))

    What to do if tinydata is missing. Valid values are: (‘emerg’,”)

  • tp_params (Hash) (defaults to: pick($tp::tp_params, {}))

    The tp_params hash to use. If not set, the global $tp::tp_params is used.

  • my_settings

    Custom settings hash. It’s merged with and can override the default tinydata settings key for the managed app

  • auto_prereq (Boolean) (defaults to: pick($tp::auto_prereq, false))

    If to automatically install the app’s prerequisites (if defined in tinydata)

  • version (Optional[String]) (defaults to: undef)

    The version to install. If not set, what’s set in the ensure parameter is used

  • source (Optional[String]) (defaults to: undef)

    The source URL to download the app from. If not set, the URL is taken from tinydata

  • owner (String[1]) (defaults to: pick(getvar('identity.user'),'root'))

    The owner of the app’s downloaded and extracted files

  • group (String[1]) (defaults to: pick(getvar('identity.group'),'root'))

    The group of the app’s downloaded and extracted files

  • settings (Hash) (defaults to: {})


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
84
85
86
87
# File 'manifests/install/source.pp', line 44

define tp::install::source (
  Variant[Boolean,String] $ensure           = present,

  Tp::Fail $on_missing_data = pick(getvar('tp::on_missing_data'),'notify'),

  Hash $tp_params                             = pick($tp::tp_params, {}),
  Hash $settings                              = {},

  Boolean $auto_prereq                        = pick($tp::auto_prereq, false),

  Optional[String]               $version     = undef,
  Optional[String]               $source      = undef,
  String[1] $owner = pick(getvar('identity.user'),'root'),
  String[1] $group = pick(getvar('identity.group'),'root'),

) {
  $app = $title
  $sane_app = regsubst($app, '/', '_', 'G')
  $destination = getvar('settings.destination')

  $tp_dir          = $tp::real_tp_params['conf']['path']
  $real_source = $ensure ? {
    'absent' => false,
    default  => pick($source,getvar('settings.urls.source'),getvar('settings.git_source'), false),
  }

  # Automatic dependencies management, if data defined
  if $auto_prereq and getvar('settings.build.prerequisites') and $ensure != 'absent' {
    tp::create_everything ( getvar('settings.build.prerequisites'), {})
  }

  if $real_source {
    tp::source { $app:
      ensure          => $ensure,
      source          => $real_source,
      path            => $destination,
      vcsrepo_options => delete_undef_values({
          revision => $version,
      }),
    }
  } else {
    tp::fail($on_missing_data, "tp::install::source ${app} - Missing parameter source or tinydata: settings.git_url") # lint:ignore:140chars
  }
}