ansible.builtin.gitlab_user (v2.9.27) — module

Creates/updates/deletes GitLab Users

| "added in version" 2.1 of ansible.builtin"

Authors: Werner Dijkerman (@dj-wasabi), Guillaume Martinez (@Lunik)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

When the user does not exist in GitLab, it will be created.

When the user does exists and state=absent, the user will be deleted.

When changes are made to user, the user will be updated.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Delete GitLab User"
  gitlab_user:
    api_url: https://gitlab.example.com/
    api_token: "{{ access_token }}"
    validate_certs: False
    username: myusername
    state: absent
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Create GitLab User"
  gitlab_user:
    api_url: https://gitlab.example.com/
    validate_certs: True
    api_username: dj-wasabi
    api_password: "MySecretPassword"
    name: My Name
    username: myusername
    password: mysecretpassword
    email: me@example.com
    sshkey_name: MySSH
    sshkey_file: ssh-rsa AAAAB3NzaC1yc...
    state: present
    group: super_group/mon_group
    access_level: owner
  delegate_to: localhost

Inputs

    
name:
    description:
    - Name of the user you want to create
    required: true
    type: str

email:
    description:
    - The email that belongs to the user.
    required: true
    type: str

group:
    description:
    - Id or Full path of parent group in the form of group/name
    - Add user as an member to this group.
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - create or delete group.
    - Possible values are present and absent.
    type: str

api_url:
    description:
    - The resolvable endpoint for the API
    type: str

confirm:
    default: true
    description:
    - Require confirmation.
    type: bool
    version_added: '2.4'
    version_added_collection: ansible.builtin

isadmin:
    default: false
    description:
    - Grant admin privileges to the user
    type: bool
    version_added: '2.8'
    version_added_collection: ansible.builtin

external:
    default: false
    description:
    - Define external parameter for this user
    type: bool
    version_added: '2.8'
    version_added_collection: ansible.builtin

password:
    description:
    - The password of the user.
    - GitLab server enforces minimum password length to 8, set this value with 8 or more
      characters.
    required: true
    type: str

username:
    description:
    - The username of the user.
    required: true
    type: str

api_token:
    aliases:
    - login_token
    description:
    - GitLab token for logging in.
    type: str

login_user:
    description:
    - GitLab user name.
    type: str

server_url:
    description:
    - The URL of the GitLab server, with protocol (i.e. http or https).
    type: str

sshkey_file:
    description:
    - The ssh key itself.
    type: str

sshkey_name:
    description:
    - The name of the sshkey
    type: str

access_level:
    choices:
    - guest
    - reporter
    - developer
    - master
    - maintainer
    - owner
    default: guest
    description:
    - The access level to the group. One of the following can be used.
    - guest
    - reporter
    - developer
    - master (alias for maintainer)
    - maintainer
    - owner
    type: str

api_password:
    description:
    - The password to use for authentication against the API
    type: str

api_username:
    description:
    - The username to use for authentication against the API
    type: str

login_password:
    description:
    - GitLab password for login_user
    type: str

validate_certs:
    default: true
    description:
    - Whether or not to validate SSL certs when supplying a https endpoint.
    type: bool

Outputs

error:
  description: the error message returned by the GitLab API
  returned: failed
  sample: '400: path is already in use'
  type: str
msg:
  description: Success or failure message
  returned: always
  sample: Success
  type: str
result:
  description: json parsed response from the server
  returned: always
  type: dict
user:
  description: API object
  returned: always
  type: dict