Sha256: 883c70267df29935c0ad641dc3751f3df2e6374fe88d51d1c5f71cd335c83db5

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

# Creates a user in the console and generates a token for them
# You can still pass name into this, it will work.
#
define console::user (
  String        $password,
  String        $ensure       = 'present',
  String        $display_name = $name,
  String        $email        = 'foo@puppet.com',
  Array[String] $roles        = [ 'Operators' ],
) {
  include ::console
  rbac_user { $title:
    ensure       => $ensure,
    name         => $name,
    display_name => $display_name,
    email        => $email,
    password     => $password,
    roles        => $roles,
  }

  exec { "create_${title}_token":
    command => "echo \"${password}\" | puppet access login --username ${name} --lifetime 0 --print | tail -n1 > ${::console::token_dir}/${name}",
    creates => "${::console::token_dir}/${name}",
    path    => $::path,
    require => Rbac_user[$title],
  }

  file { "${::console::token_dir}/${name}":
    ensure  => file,
    owner   => 'pe-puppet',
    group   => 'pe-puppet',
    mode    => '0600',
    require => Exec["create_${title}_token"],
  }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
onceover-4.0.0 spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/manifests/user.pp
onceover-3.22.0 spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/manifests/user.pp