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
|
# File 'manifests/auth/flat_file.pp', line 25
class st2::auth::flat_file(
$cli_username = $st2::cli_username,
$cli_password = $st2::cli_password,
$conf_file = $st2::conf_file,
$htpasswd_file = $st2::params::auth_htpasswd_file,
) inherits st2 {
include st2::auth::common
$_auth_users = hiera_hash('st2::auth_users', {})
file { $htpasswd_file:
ensure => file,
owner => 'st2',
group => 'st2',
mode => '0600',
}
ini_setting { 'auth_backend':
ensure => present,
path => $conf_file,
section => 'auth',
setting => 'backend',
value => 'flat_file',
tag => 'st2::config',
}
ini_setting { 'auth_backend_kwargs':
ensure => present,
path => $conf_file,
section => 'auth',
setting => 'backend_kwargs',
value => "{\"file_path\": \"${htpasswd_file}\"}",
tag => 'st2::config',
}
# System Users
st2::auth_user { $cli_username:
password => $cli_password,
}
# Automatically generate users from Hiera
create_resources('st2::auth_user', $_auth_users)
##############
# Dependencies
File[$htpasswd_file]
-> Service<| tag == 'st2::service' |>
}
|