Defined Type: foreman::user

Defined in:
manifests/user.pp

Overview

Define: foreman::add_user

Adds a user to authenticate to the Foreman web UI or REST API.

NOTE: Setting users in Puppet will take precedence over all changes made in the web browser. Changes made manually in the web browser will be automatically overwritten on the next Puppet run.

Parameters

auth_source

Type: String Default: None - Required parameter.

The name of the authentication source for this user. If this user is to be authenticated internally by foreman, this should be set to ‘Internal’. Otherwise, this should be the name of the LDAP authentication source that has been defined inside of the Foreman.

api_admin

Type: Boolean Default: false

Whether or not this is the admin user who connects to the REST API in order to perform transactions. NOTE: Unless you are positive this is the primary admin user, do not set this variable to true. This user should really only be used internally, not for basic use in the web UI.

Authors

  • Kendall Moore <kmoore@keywcorp.com>

Parameters:

  • auth_source (Any)
  • password (Any) (defaults to: '')
  • api_admin (Any) (defaults to: false)
  • web_admin (Any) (defaults to: false)
  • email (Any) (defaults to: '')
  • firstname (Any) (defaults to: '')
  • lastname (Any) (defaults to: '')


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
# File 'manifests/user.pp', line 34

define foreman::user(
  $auth_source,
  $password       = '',
  $api_admin      = false,
  $web_admin      = false,
  $email          = '',
  $firstname      = '',
  $lastname       = ''
){
  unless defined('$::foreman::admin_user') {
    fail("Error: You must include '::foreman' prior to using 'foreman::user'")
  }

  $admin_user     = $::foreman::admin_user
  $admin_password = $::foreman::admin_password
  $host           = $::foreman::server

  $_email = empty($email) ? {
    true    => "${name}@${::domain}",
    default => $email
  }

  foreman_user { $name:
    admin_user     => $admin_user,
    admin_password => $admin_password,
    host           => $host,
    auth_source    => $auth_source,
    api_admin      => $api_admin,
    password       => $password,
    web_admin      => $web_admin,
    email          => $_email,
    firstname      => $firstname,
    lastname       => $lastname
  }
}