Skip to main content

Ansible module to detect the existence of user(s) on UNIX operation systems.

Project description

ansible-module-userdetect

> USERDETECT    (/etc/ansible/library/userdetect.py)

        Detect the existence of user(s) on UNIX operation systems.
        This module only reports about the existence of users. It
        doesn’t change any data. Use the register key to catch the
        returned informatins about the users.

OPTIONS (= is mandatory):

- fallback
        User to look for if the main user can’t be detected.
        default: null

- user
        The name of the user or a list of users. Users can be
        specified as a comma separted list (user1,user2) or as a YAML
        list.
        default: null

AUTHOR: Josef Friedrich (@Josef-Friedrich)

METADATA:
  metadata_version: '0.1'
  status:
  - preview
  supported_by: community

EXAMPLES:

- name: Detect user “jf”
  userdetect: user=jf
  register: user

- name: Detect fallback user “root”.
  userdetect: user=lol
              fallback=root
  register: user

- name: Detect users as a list
  userdetect:
    user:
      - jf
      - root
  register: user

- name: Detect users as a comma separated list
  userdetect: user=jf,root
  register: user

RETURN VALUES:
- all
        A list of all users containing a dictionary with the keys
        “username”, “exists”, “uid”, “gid”, “home”, “shell”.
        returned: In multi mode
        type: list

- existent
        A list of all existing users containing a dictionary with the
        keys “username”, “exists”, “uid”, “gid”, “home”, “shell”.
        returned: In multi mode
        type: list

- exists
        Indicates if the user exists
        returned: always
        sample: true
        type: boolean

- fallback
        Indicates if the user is a the fallback user or not.
        returned: If the user exists
        sample: true
        type: boolean

- gid
        The group ID
        returned: If the user exists
        sample: 1000
        type: integer

- home
        The path of the home folder
        returned: If the user exists
        sample: /home/jf
        type: string

- non_existent
        A list of all non existing users containing a dictionary with
        the keys “username”, “exists”, “uid”, “gid”, “home”, “shell”.
        returned: In multi mode
        type: list

- shell
        The absoltue path of the shell the user uses.
        returned: If the user exists
        sample: /bin/bash
        type: string

- uid
        The user ID
        returned: If the user exists
        sample: 1000
        type: integer

- username
        The name of the user
        returned: always
        sample: root
        type: string

Development

Test functionality

/usr/local/src/ansible/hacking/test-module -m userdetect.py -a

Test documentation

source /usr/local/src/ansible/hacking/env-setup
/usr/local/src/ansible/test/sanity/validate-modules/validate-modules --arg-spec --warnings userdetect.py

Generate documentation

ansible-doc -M . userdetect

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

userdetect-0.1.0.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

userdetect-0.1.0-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file userdetect-0.1.0.tar.gz.

File metadata

  • Download URL: userdetect-0.1.0.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.12 Linux/6.5.0-27-generic

File hashes

Hashes for userdetect-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fac5e3b58100030c47a6c6febcfdcd4d0141b71ad52bbfbcdef5bd9a416cb1ee
MD5 a561aa34414cd91d2b9b9a839479b27f
BLAKE2b-256 e3b756ddb82717cbdc36437892f6e996edd6cb5a16ee28a751b10cad13623d82

See more details on using hashes here.

File details

Details for the file userdetect-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: userdetect-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.12 Linux/6.5.0-27-generic

File hashes

Hashes for userdetect-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a08a8a70b76bc50d93984d267fa08e2ed60ad52eb98a91a2ac772ea9ca25a6b5
MD5 3cd2e82e252a4fdb4f349f6ee8ebd57f
BLAKE2b-256 09de3067d4015a79e932de2a57e2cee800d12500e485ef72cf06dc367859ab5e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page