User

  • user.add
  • user.group

user.add

Adds a user to the system.

KeyTypeOptionalDescription
actionstringnouser.add
usernamestringnousername of user
fullnamestringyesfull name of user
home_dirstringyeshome directory of user, the tool's default without it
shellstringyesshell for user, the tool's default without it
grouplistyesgroups to add new user to

On Linux, macOS and FreeBSD, a user that exists already is left alone. The action fails when username is empty or the tool to create users (useradd, dscl or pw) isn't installed.

Example

- action: user.add
  fullname: testuser
  home_dir: /home/test
  username: test
  shell: sh

# Add user while also adding to groups
- action: user.add
  fullname: testuser
  home_dir: /home/test
  username: test
  shell: sh
  group:
  - testgroup

user.group

Adds an already created user to a group.

KeyTypeOptionalDescription
actionstringnouser.group
usernamestringnousername of user to add to group
grouplistnogroups to add user to

The action fails when username or group is empty, or the tool (usermod, dscl or pw) isn't installed.

Example

- action: user.group
  username: test
  group:
  - wheel