-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Definition: st2::rbac | ||
# | ||
# This defined type creates RBAC resources for users | ||
# This is an enterprise feature, and requires a license | ||
# to be used. | ||
# | ||
define st2::rbac ( | ||
$ensure = 'present', | ||
$user = $name, | ||
$description = "Created and managed by Puppet", | ||
$roles = [], | ||
) { | ||
$_rbac_dir = '/opt/stackstorm/rbac' | ||
|
||
ensure_resource('file', $_rbac_dir, { | ||
'ensure' => 'directory', | ||
'owner' => 'root', | ||
'group' => 'root', | ||
'mode' => '0755', | ||
'require' => Class['::st2::profile::server'], | ||
}) | ||
ensure_resource('file', "${_rbac_dir}/assignments", { | ||
'ensure' => 'directory', | ||
'owner' => 'root', | ||
'group' => 'root', | ||
'mode' => '0755', | ||
'require' => Class['::st2::profile::server'], | ||
}) | ||
ensure_resource('file', "${_rbac_dir}/assignments", { | ||
'ensure' => 'directory', | ||
'owner' => 'root', | ||
'group' => 'root', | ||
'mode' => '0755', | ||
'require' => Class['::st2::profile::server'], | ||
}) | ||
ensure_resource('exec', 'reload st2 rbac definitions', { | ||
'cmd' => 'st2-apply-rbac-definitions', | ||
'refreshonly' => 'true', | ||
'path' => '/usr/sbin:/usr/bin:/sbin:/bin', | ||
}) | ||
file { "${_rbac_dir}/assignments/${user}.yaml": | ||
ensure => 'file', | ||
owner => 'root', | ||
group => 'root', | ||
mode => '0644', | ||
content => template('st2/rbac/assignments/user.yaml.erb'), | ||
notify => Exec['reload st2 rbac definitions'], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
username: "<%= @user %>" | ||
description: "<%= @description %>" | ||
enabled: <%= @_enabled_state %> | ||
roles: | ||
<%- @roles.each do |role| -%> | ||
- "<%= role %>" | ||
<%- end -%> |