accounts

Account management module.

961,833 downloads

476 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 8.3.0 (latest)
  • 8.2.2
  • 8.2.1
  • 8.2.0
  • 8.1.1
  • 8.1.0
  • 8.0.0
  • 7.3.1
  • 7.3.0
  • 7.2.0
  • 7.1.1
  • 7.1.0
  • 7.0.2
  • 7.0.1
  • 7.0.0
  • 6.4.0
  • 6.3.0
  • 6.2.0
  • 6.1.1
  • 6.1.0 (deleted)
  • 6.0.0
  • 5.0.0
  • 4.2.0
  • 4.1.0
  • 4.0.0
  • 3.2.0
  • 3.1.0
  • 3.0.0
  • 2.0.0
  • 1.3.0
  • 1.2.1
  • 1.2.0
  • 1.1.0
  • 1.0.0
released Aug 2nd 2019
This version is compatible with:
  • Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x
  • Puppet >= 5.5.10 < 7.0.0
  • , , , , , , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'puppetlabs-accounts', '4.2.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add puppetlabs-accounts
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install puppetlabs-accounts --version 4.2.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

puppetlabs/accounts — version 4.2.0 Aug 2nd 2019

Reference

Table of Contents

Classes

  • accounts: This class auto-creates user and group resources from hiera data.

Defined types

Public Defined types

  • accounts::user: This resource manages the user, group, vim/, .ssh/, .bash_profile, .bashrc, homedir, .ssh/authorized_keys files, and directories.

Private Defined types

  • accounts::home_dir: This resource specifies how home directories are managed.
  • accounts::key_management: This resource specifies where ssh keys are managed.
  • accounts::manage_keys: This resource manages ssh keys for a user.

Functions

  • accounts_ssh_options_parser: Parse an ssh authorized_keys option string into an array using its expected pattern which matches a crazy regex slightly modified from shell

Classes

accounts

This class auto-creates user and group resources from hiera data.

Parameters

The following parameters are available in the accounts class.

group_defaults

Data type: Accounts::Group::Resource

Hash of default attributes for group resources managed by this class.

Default value: {}

group_list

Data type: Accounts::Group::Hash

Hash of group resources for this class to manage. The hash is keyed by group name.

Default value: {}

user_defaults

Data type: Accounts::User::Resource

Hash of default attributes for accounts::user resources managed by this class.

Default value: {}

user_list

Data type: Accounts::User::Hash

Hash of accounts::user resources for this class to manage. The hash is keyed by user name.

Default value: {}

Defined types

accounts::user

This resource manages the user, group, vim/, .ssh/, .bash_profile, .bashrc, homedir, .ssh/authorized_keys files, and directories.

Examples

Basic usage
accounts::user { 'bob':
  uid      => '4001',
  gid      => '4001',
  group    => 'staff',
  shell    => '/bin/bash',
  password => '!!',
  locked   => false,
}

Parameters

The following parameters are available in the accounts::user defined type.

ensure

Data type: Enum['absent','present']

Specifies whether the user, its primary group, homedir, and ssh keys should exist. Valid values are 'present' and 'absent'. Note that when a user is created, a group with the same name as the user is also created.

Default value: 'present'

allowdupe

Data type: Boolean

Whether to allow duplicate UIDs. By default false

Default value: false

bash_profile_content

Data type: Optional[String]

The content to place in the user's ~/.bash_profile file. Mutually exclusive to bash_profile_source.

Default value: undef

bash_profile_source

Data type: Optional[Stdlib::Filesource]

A source file containing the content to place in the user's ~/.bash_profile file. Mutually exclusive to bash_profile_content.

Default value: undef

bashrc_content

Data type: Optional[String]

The content to place in the user's ~/.bashrc file. Mutually exclusive to bashrc_source.

Default value: undef

bashrc_source

Data type: Optional[Stdlib::Filesource]

A source file containing the content to place in the user's ~/.bashrc file. Mutually exclusive to bashrc_content.

Default value: undef

comment

Data type: String

A comment describing or regarding the user.

Default value: $name

create_group

Data type: Boolean

Specifies if you want to create a group with the user's name.

Default value: true

expiry

Data type: Optional[Accounts::User::Expiry]

Specifies the date the user account expires on. Valid values: YYYY-MM-DD date format, or 'absent' to remove expiry date.

Default value: undef

forcelocal

Data type: Optional[Boolean]

Specifies whether you want to manage a local user/group that is also managed by a network name service.

Default value: undef

forward_content

Data type: Optional[String]

The content to place in the user's ~/.forward file. Mutually exclusive to forward_source.

Default value: undef

forward_source

Data type: Optional[Stdlib::Filesource]

A source file containing the content to place in the user's ~/.forward file. Mutually exclusive to forward_content.

Default value: undef

gid

Data type: Optional[Accounts::User::Uid]

Specifies the gid of the user's primary group. Must be specified numerically.

Default value: undef

group

Data type: Accounts::User::Name

Specifies the name of the user's primary group. By default, this uses a group named the same as user name

Default value: $name

groups

Data type: Array[Accounts::User::Name]

Specifies the user's group memberships.

Default value: []

home

Data type: Optional[Stdlib::Unixpath]

Specifies the path to the user's home directory.

  • Linux, non-root user: '/home/$name'

  • Linux, root user: '/root'

  • Solaris, non-root user: '/export/home/$name'

  • Solaris, root user: '/'

Default value: undef

home_mode

Data type: Optional[Stdlib::Filemode]

Manages the user's home directory permission mode. Valid values are in octal notation, specified as a string. Defaults to undef, which creates a home directory with 0700 permissions. It does not touch them if the directory already exists. Keeping it undef also allows a user to manage their own permissions. If home_mode is set, Puppet enforces the permissions on every run.

Default value: undef

ignore_password_if_empty

Data type: Boolean

Specifies whether an empty password field should be ignored. If set to true, this ignores a password field that is defined but empty. If set to false, it sets the password to an empty value.

Default value: false

iterations

Data type: Optional[Accounts::User::Iterations]

This is the number of iterations of a chained computation of the PBKDF2 password hash. This field is required for managing passwords on OS X >= 10.8.

Default value: undef

locked

Data type: Boolean

Specifies whether the account should be locked and the user prevented from logging in. Set to true for users whose login privileges have been revoked.

Default value: false

managehome

Data type: Boolean

Specifies whether the user's home directory should be created when adding a user.

Default value: true

managevim

Data type: Boolean

Specifies whether or not the .vim folder should be created within the managed accounts home directory.

Default value: true

membership

Data type: Enum['inclusive','minimum']

Establishes whether specified groups should be considered the complete list (inclusive) or the minimum list (minimum) of groups to which the user belongs. Valid values: 'inclusive', 'minimum'.

Default value: 'minimum'

name

Name of the user.

password

Data type: String

The user's password, in whatever encrypted format the local machine requires. Default: '!!', which prevents the user from logging in with a password.

Default value: '!!'

password_max_age

Data type: Optional[Accounts::User::PasswordMaxAge]

Maximum number of days a password may be used before it must be changed. Allows any integer from 0 to 99999. See the user resource.

Default value: undef

purge_sshkeys

Data type: Boolean

Whether keys not included in sshkeys should be removed from the user. If purge_sshkeys is true and sshkeys is an empty array, all SSH keys will be removed from the user.

Default value: false

purge_user_home

Data type: Boolean

Whether to force recurse remove user home directories when removing a user. Defaults to false.

Default value: false

salt

Data type: Optional[String]

This is the 32-byte salt used to generate the PBKDF2 password used in OS X. This field is required for managing passwords on OS X >= 10.8.

Default value: undef

shell

Data type: Optional[Stdlib::Unixpath]

Manages the user shell.

Default value: '/bin/bash'

sshkey_custom_path

Data type: Optional[Stdlib::Unixpath]

Custom location for ssh public key file.

Default value: undef

sshkey_owner

Data type: Optional[Accounts::User::Name]

Specifies the owner of the sshkey file .ssh/authorized_keys.

Default value: $name

sshkeys

Data type: Array[String]

An array of SSH public keys associated with the user. These should be complete public key strings that include the type, content and name of the key, exactly as it would appear in its id_*.pub file, or with an optional options string preceding the other components, as it would appear as an entry in an authorized_keys file. Must be an array.

Examples:

Note that for multiple keys, the name component (the last) must be unique.

Default value: []

system

Data type: Boolean

Specifies if you want to create a system account.

Default value: false

uid

Data type: Optional[Accounts::User::Uid]

Specifies the user's uid number. Must be specified numerically.

Default value: undef

Functions

accounts_ssh_options_parser

Type: Ruby 4.x API

Parse an ssh authorized_keys option string into an array using its expected pattern which matches a crazy regex slightly modified from shell words. The pattern should be a string.

Examples

Calling the function
accounts_ssh_option_parser_string()

accounts_ssh_options_parser(String $str)

Parse an ssh authorized_keys option string into an array using its expected pattern which matches a crazy regex slightly modified from shell words. The pattern should be a string.

Returns: Array Separated components of the string

Examples
Calling the function
accounts_ssh_option_parser_string()
str

Data type: String

ssh authorized_keys option string