Puppet Class: st2::auth::common

Inherits:
st2
Defined in:
manifests/auth/common.pp

Summary

Class that contains all of the "common" settings for auth.

Overview

Note:

Don’t use directly

Parameters:

  • api_url (Any) (defaults to: $st2::auth_api_url)

    URL to the StackStorm API

  • conf_file (Any) (defaults to: $st2::conf_file)

    The path where st2 config is stored

  • debug (Any) (defaults to: $st2::auth_debug)

    Enable Debug (default: false)

  • mode (Any) (defaults to: $st2::auth_mode)

    Authentication mode, either ‘standalone’ or ‘proxy’ (default: standalone)

  • use_ssl (Any) (defaults to: $st2::use_ssl)

    Enable SSL (default: false)

  • ssl_cert (Any) (defaults to: $st2::ssl_cert)

    Path to SSL Certificate file (default: ‘/etc/ssl/st2/st2.crt’)

  • ssl_key (Any) (defaults to: $st2::ssl_key)

    Path to SSL Key file (default: ‘/etc/ssl/st2/st2.key’)



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
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'manifests/auth/common.pp', line 20

class st2::auth::common (
  $api_url   = $st2::auth_api_url,
  $conf_file = $st2::conf_file,
  $debug     = $st2::auth_debug,
  $mode      = $st2::auth_mode,
  $use_ssl   = $st2::use_ssl,
  $ssl_cert  = $st2::ssl_cert,
  $ssl_key   = $st2::ssl_key,
) inherits st2 {

  $_debug = $debug ? {
    true    => 'True',
    default => 'False',
  }
  $_mode = $mode ? {
    'standalone' => 'standalone',
    'proxy'      => 'proxy',
    default      => undef,
  }
  if $_mode == undef {
    fail("[st2::auth] Unsupported mode: ${mode}")
  }
  $_use_ssl = $use_ssl ? {
    true    => 'True',
    default => 'False',
  }

  ini_setting { 'auth_mode':
    ensure  => present,
    path    => $conf_file,
    section => 'auth',
    setting => 'mode',
    value   => $_mode,
    tag     => 'st2::config',
  }
  ini_setting { 'auth_debug':
    ensure  => present,
    path    => $conf_file,
    section => 'auth',
    setting => 'debug',
    value   => $_debug,
    tag     => 'st2::config',
  }
  ini_setting { 'auth_ssl':
    ensure  => present,
    path    => $conf_file,
    section => 'auth',
    setting => 'use_ssl',
    value   => $_use_ssl,
    tag     => 'st2::config',
  }
  ini_setting { 'auth_api_url':
    ensure  => present,
    path    => $conf_file,
    section => 'auth',
    setting => 'api_url',
    value   => $api_url,
    tag     => 'st2::config',
  }

  # SSL Settings
  if $use_ssl {
    if !$ssl_cert or !$ssl_key {
      fail('[st2::auth] Missing $ssl_cert or $ssl_key to enable SSL')
    }

    ini_setting { 'auth_ssl_cert':
      ensure  => present,
      path    => $conf_file,
      section => 'auth',
      setting => 'cert',
      value   => $ssl_cert,
      tag     => 'st2::config',
    }
    ini_setting { 'auth_ssl_key':
      ensure  => present,
      path    => $conf_file,
      section => 'auth',
      setting => 'key',
      value   => $ssl_key,
      tag     => 'st2::config',
    }
  }
}