Provision

user_exists

Return 0 if the given username exists on the system.

Arguments

  • $1 (string): Username

Exit codes

  • 0: User exists; 1 Not found

group_exists

Return 0 if the given group name exists on the system.

Arguments

  • $1 (string): Group name

Exit codes

  • 0: Group exists; 1 Not found

ensure_group_exists

Ensure a group exists, creating it if it does not. No-op if the group already exists (idempotent).

Arguments

  • $1 (string): Group name

Exit codes

  • 0: Group exists (or was created); 1 Creation failed; 2 Missing argument

ensure_user_exists

Ensure a user exists, creating it if it does not. No-op if the user already exists (idempotent). Extra arguments are passed to useradd.

Example

ensure_user_exists deploy -m -s /bin/bash -G wheel

Arguments

  • $1 (string): Username
  • ... (string): Additional useradd arguments (e.g. -m, -s /bin/bash, -G wheel)

Exit codes

  • 0: User exists (or was created); 1 Creation failed; 2 Missing argument