community / community.general / 2.5.9 / module / gitlab_user Creates/updates/deletes/blocks/unblocks GitLab Users Authors: Werner Dijkerman (@dj-wasabi), Guillaume Martinez (@Lunik)community.general.gitlab_user (2.5.9) — module
Install with ansible-galaxy collection install community.general:==2.5.9
collections: - name: community.general version: 2.5.9
When the user does not exist in GitLab, it will be created.
When the user exists and state=absent, the user will be deleted.
When the user exists and state=blocked, the user will be blocked.
When changes are made to user, the user will be updated.
- name: "Delete GitLab User" community.general.gitlab_user: api_url: https://gitlab.example.com/ api_token: "{{ access_token }}" validate_certs: False username: myusername state: absent
- name: "Create GitLab User" community.general.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
- name: "Block GitLab User" community.general.gitlab_user: api_url: https://gitlab.example.com/ api_token: "{{ access_token }}" validate_certs: False username: myusername state: blocked
- name: "Unblock GitLab User" community.general.gitlab_user: api_url: https://gitlab.example.com/ api_token: "{{ access_token }}" validate_certs: False username: myusername state: unblocked
name: description: - Name of the user you want to create. - Required only if C(state) is set to C(present). type: str email: description: - The email that belongs to the user. - Required only if C(state) is set to C(present). 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 - blocked - unblocked default: present description: - Create, delete or block a user. type: str api_url: description: - The resolvable endpoint for the API type: str confirm: default: true description: - Require confirmation. type: bool isadmin: default: false description: - Grant admin privileges to the user. type: bool external: default: false description: - Define external parameter for this user. type: bool password: description: - The password of the user. - GitLab server enforces minimum password length to 8, set this value with 8 or more characters. - Required only if C(state) is set to C(present). type: str username: description: - The username of the user. required: true type: str api_token: description: - GitLab token for logging in. 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 validate_certs: default: true description: - Whether or not to validate SSL certs when supplying a https endpoint. type: bool
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