Puppet Class: keycloak::install

Defined in:
manifests/install.pp

Overview

Private class.



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
# File 'manifests/install.pp', line 2

class keycloak::install {
  assert_private()

  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,
      system     => $keycloak::system_user,
    }
    group { 'keycloak':
      ensure     => 'present',
      name       => $keycloak::group,
      forcelocal => true,
      gid        => $keycloak::group_gid,
      system     => $keycloak::system_user,
    }
  }

  if $keycloak::manage_install {
    file { $keycloak::install_base:
      ensure => 'directory',
      owner  => $keycloak::user,
      group  => $keycloak::group,
      mode   => '0755',
    }
    -> archive { "keycloak-${keycloak::version}.tar.gz":
      ensure          => 'present',
      extract         => true,
      path            => "/tmp/keycloak-${keycloak::version}.tar.gz",
      extract_path    => $keycloak::install_base,
      extract_command => 'tar xfz %s --strip-components=1',
      source          => $keycloak::download_url,
      creates         => "${keycloak::install_base}/bin",
      cleanup         => true,
      user            => $keycloak::user,
      group           => $keycloak::group,
    }
  } else {
    # Set permissions properly when using a package
    exec { 'ensure-keycloak-dir-owner':
      command => "chown -R ${keycloak::user}:${keycloak::group} ${keycloak::install_base}",
      unless  => "test `stat -c %U ${keycloak::install_base}` = ${keycloak::user}",
      path    => ['/bin','/usr/bin'],
    }
  }
}