Defined Type: st2::pack

Defined in:
manifests/pack.pp

Summary

Manages a StackStorm Pack

Overview

Examples:

Basic Usage

st2::pack { 'puppet': }

Install from a custom URL

st2::pack { 'custom':
  repo_url => 'http://github.com/myorg/stackstorm-custom.git',
}

Parameters:

  • pack (Any) (defaults to: $name)

    Name of the pack to install.

  • repo_url (Any) (defaults to: undef)

    URL of the package to install when not installing from the exchange.

  • config (Any) (defaults to: undef)

    Hash that will be translated into YAML in the pack’s config file after installation.

  • ensure (Any) (defaults to: present)
  • version (Any) (defaults to: undef)


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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'manifests/pack.pp', line 18

define st2::pack (
  $ensure   = present,
  $pack     = $name,
  $repo_url = undef,
  $config   = undef,
  $version  = undef,
) {
  include st2
  $_cli_username = $st2::cli_username
  $_cli_password = $st2::cli_password
  $_cli_apikey = $st2::cli_apikey

  st2_pack { $pack:
    ensure   => $ensure,
    name     => $pack,
    user     => $_cli_username,
    password => $_cli_password,
    apikey   => $_cli_apikey,
    source   => $repo_url,
    version  => $version,
  }

  if $config {
    validate_hash($config)
    file { "/opt/stackstorm/configs/${pack}.yaml":
      ensure  => file,
      mode    => '0640',
      owner   => 'st2',
      group   => 'root',
      content => template('st2/config.yaml.erb'),
    }

    # Register package after it is downloaded and configured
    St2_pack<| name == $pack |>
    -> File["/opt/stackstorm/configs/${pack}.yaml"]
    ~> Exec<| tag == 'st2::register-configs' |>
  }

  Service<| tag == 'st2::service' |> -> St2_pack<||>
  Exec<| tag == 'st2::reload' |> -> St2_pack<||>
}