Defined Type: variance::user

Defined in:
manifests/user.pp

Overview

Define: variance::user

Introduce random changes to some nodes to demonstrate variance in PE Console

Actions: Creates a user, group and home directory. Users shell value comes from the fqdn_function to introduce variance.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'manifests/user.pp', line 7

define variance::user {

  $random_shell_choice = fqdn_rand(4)

  $shell = $random_shell_choice ? {
    '0' => '/bin/bash',
    '1' => '/bin/ksh',
    '2' => '/bin/sh',
    '3' => '/sbin/nologin',
  }

  user { $name:
    ensure     => present,
    home       => "/home/${name}",
    shell      => $shell,
  }

  if ! defined ( Group[$name] ) {
    group { $name:
      ensure => $ensure,
    }
  }

}