user

This resource manages a user on the client.

Relationship to other resources

A user implicitly depends on group resources whose name parameter matches one of the strings in the groups array as supplementary groups must be processed first.

Parameters

NameTypeDescriptionMandatoryDefault
ensurestringDetermines the desired state of the resource. One of present or absent.yespresent
namestringPrimary parameter: The user name.yes
systemstringDetermines if the user is a system user. One of true or false.yesfalse
commentstringAn optional comment to add to the database entry for this user.no
shellstringThe path to the login shell of this user. Note that when this parameter is omitted, platform-dependent defaults may apply.no
homestringThe home directory of this user.no/home/<name>
passwordstringThe password hash of this user.no! which means "locked"
expiry_datestringThe date at which the account should expire, in the format YYYY-MM-DD. Note that when this parameter is omitted, platform-dependent defaults may apply.no
groupstringThe name of the user's primary group.nosame as name
groupsarrayA list of names of supplementary groups that the user should be a member of. Array items must be strings.no

Examples

resources:
  - type: user
    parameters:
      name: myuser
resources:
  - type: user
    parameters:
	  ensure: present
      name: myuser
	  system: true
      comment: Employee of the Year
      shell: /bin/zsh
      home: /home/myuser
      password: $6$ugth6io4j7fQHBxh$oDr51KYqju5jMr/lCsYpAouzxOINxhyZhiSRH1220TOZ8VRMxxNaGXnv.JzH/XUN9oezau7sKqrBlcdQfqmGv0
      expiry_date: 2025-12-31
      group: myuser
      groups:
	    - ssh-login
	    - team-xyz