Skip to content

Commit

Permalink
Merge pull request #53 from cborisa/usermanage
Browse files Browse the repository at this point in the history
manage user support
  • Loading branch information
treydock committed Apr 9, 2019
2 parents a08a2fd + 1de1974 commit e2b29b9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
5 changes: 4 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
# Default is `true`.
# @param service_java_opts
# Sets additional options to Java virtual machine environment variable.
# @param manage_user
# Defines if the module should manage the Linux user for Keycloak installation
# @param user
# Keycloak user name.
# Default is `keycloak`.
Expand Down Expand Up @@ -148,6 +150,7 @@
Boolean $service_hasrestart = $keycloak::params::service_hasrestart,
Optional[Variant[String, Array]]
$service_java_opts = undef,
Boolean $manage_user = true,
String $user = 'keycloak',
String $group = 'keycloak',
Optional[Integer] $user_uid = undef,
Expand Down Expand Up @@ -185,7 +188,7 @@
Boolean $manage_sssd_config = true,
Array $sssd_ifp_user_attributes = [],
Boolean $restart_sssd = true,
Optional[Stdlib::Absolutepath] $service_environment_file = undef
Optional[Stdlib::Absolutepath] $service_environment_file = undef,
) inherits keycloak::params {

$download_url = pick($package_url, "https://downloads.jboss.org/keycloak/${version}/keycloak-${version}.tar.gz")
Expand Down
39 changes: 19 additions & 20 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
class keycloak::install {
assert_private()

user { 'keycloak':
ensure => 'present',
name => $keycloak::user,
forcelocal => true,
shell => $keycloak::user_shell,
gid => $keycloak::group,
uid => $keycloak::user_uid,
home => '/var/lib/keycloak',
managehome => true,
if $keycloak::manage_user {
user { 'keycloak':
ensure => 'present',
name => $keycloak::user,
forcelocal => true,
shell => $keycloak::user_shell,
gid => $keycloak::group,
uid => $keycloak::user_uid,
home => '/var/lib/keycloak',
managehome => true,
}
group { 'keycloak':
ensure => 'present',
name => $keycloak::group,
forcelocal => true,
gid => $keycloak::group_gid,
}
}

group { 'keycloak':
ensure => 'present',
name => $keycloak::group,
forcelocal => true,
gid => $keycloak::group_gid,
}

file { "${keycloak::install_dir}/keycloak-${keycloak::version}":
ensure => 'directory',
owner => $keycloak::user,
Expand All @@ -35,8 +35,7 @@
source => $keycloak::download_url,
creates => "${keycloak::install_dir}/keycloak-${keycloak::version}/bin",
cleanup => true,
user => 'keycloak',
group => 'keycloak',
user => $keycloak::user,
group => $keycloak::group,
}

}

0 comments on commit e2b29b9

Please sign in to comment.