arensb.truenas.user module – Manage user accounts
Note
This module is part of the arensb.truenas collection (version 1.11.4).
To install it, use: ansible-galaxy collection install arensb.truenas
.
To use it in a playbook, specify: arensb.truenas.user
.
New in arensb.truenas 0.1.0
Synopsis
Add, change, and delete user accounts.
Parameters
Parameter |
Comments |
---|---|
If true, the user will be added to the groups listed in If false, the user will be added to the groups listed in Choices:
|
|
If true, the keys specified in If false, any keys not explicitly listed in Choices:
|
|
The full name (GECOS field) of the user. Default: |
|
If true, create a new group with the same name as the user. If such a group already exists, it is used and no new group is created. Choices:
|
|
If true, delete the user’s primary group if it is not being used by any other users. If false, the primary group stays, even if it is now empty. Only used when deleting a user. Choices:
|
|
User’s email address, in the form user@dom.ain. |
|
The name of the user’s primary group. Required unless |
|
List of additional groups user will be added to. If If |
|
User’s home directory. Note that TrueNAS has restrictions on what this can be. As of this writing, the home directory has to begin with “/mnt”, or be “/nonexistent”. Note that if you create a user with home directory Note: If you create an account with a home directory that does not end in the username (e.g., if |
|
Name of the user to manage. |
|
User’s password, as a crypted string. Required unless Note: Currently there is no way to check whether the password needs to be changed, so this is used only when the user is created. |
|
If true, the user’s password is disabled. They can still log in through other methods (e.g., ssh key). This is not a flag: if you set If you need that functionality, do something like prepend “*LOCK*” to the crypt string when locking a user, then remove it when unlocking. Note that under TrueNAS SCALE, a user with Choices:
|
|
User’s shell. Must be one of the allowed shells from |
|
Specifies whether user should have access to SMB shares. Under TrueNAS SCALE, a user with Choices:
|
|
List of ssh public keys to put in the user’s |
|
Whether the user should exist or not. Choices:
|
|
Deprecated. Use sudo_commands and/or sudo_commands_nopasswd instead. Whether the user is allowed to sudo (see also sudo_nopasswd and sudo_commands). Note: this defaults to false. So if you create a user with sudo: yes, then comment out that line, the user will be removed from sudo. Choices:
|
|
List of commands the user is allowed to execute using Each command must use an absolute path, except for the special value “ALL”, which allows executing any command. Commands may include options, e.g., In TrueNAS CORE, and in older versions of SCALE, only one of sudo_commands and sudo_commands_nopasswd may be specified. Default: |
|
List of commands the user is allowed to execute using Each command must use an absolute path, except for the special value “ALL”, which allows executing any command. Commands may include options, e.g., In TrueNAS CORE, and in older versions of SCALE, only one of sudo_commands and sudo_commands_nopasswd may be specified. Default: |
|
Deprecated. Use sudo_commands_nopasswd instead. Allows user to sudo without a password. Choices:
|
|
Set the UID of the user. If the IUID is already taken, this will create a second user with the same UID. |
Examples
- name: Create an ordinary user and their group
arensb.truenas.user:
name: bob
comment: "Bob the User"
create_group: yes
password: "<encrypted password string>"
- name: Create an ordinary user and put them into an existing group
arensb.truenas.user:
name: bob
comment: "Bob the User"
group: users
password: "<encrypted string>"
- name: Create a user without a working password
arensb.truenas.user:
name: bob
comment: "Bob the User"
group: bobsgroup
password_disabled: yes
- name: Delete a user
arensb.truenas.user:
name: bob
state: absent
- name: Delete a user, but keep their primary group, even if it's now empty.
arensb.truenas.user:
name: bob
state: absent
delete_group: no
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The ID of a newly-created user. This is not the uid as found in Returned: success |