Note
This plugin is part of the community.general collection.
To install it use: ansible-galaxy collection install community.general.
To use it in a playbook, specify: community.general.gitlab_user.
The below requirements are needed on the host that executes this module.
| Parameter | Choices/Defaults | Comments |
|---|---|---|
| access_level string |
| The access level to the group. One of the following can be used. guest reporter developer master (alias for maintainer) maintainer owner |
| api_password string | The password to use for authentication against the API | |
| api_token string | GitLab token for logging in. | |
| api_url string | The resolvable endpoint for the API | |
| api_username string | The username to use for authentication against the API | |
| confirm boolean |
| Require confirmation. |
| email string | The email that belongs to the user. Required only if state is set to present. | |
| external boolean |
| Define external parameter for this user. |
| group string | Id or Full path of parent group in the form of group/name. Add user as an member to this group. | |
| isadmin boolean |
| Grant admin privileges to the user. |
| name string | Name of the user you want to create. Required only if state is set to present. | |
| password string | The password of the user. GitLab server enforces minimum password length to 8, set this value with 8 or more characters. Required only if state is set to present. | |
| sshkey_file string | The ssh key itself. | |
| sshkey_name string | The name of the sshkey | |
| state string |
| Create, delete or block a user. |
| username string / required | The username of the user. | |
| validate_certs boolean |
| Whether or not to validate SSL certs when supplying a https endpoint. |
Note
- 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: [email protected]
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
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description |
|---|---|---|
| error string | failed | the error message returned by the GitLab API Sample: 400: path is already in use |
| msg string | always | Success or failure message Sample: Success |
| result dictionary | always | json parsed response from the server |
| user dictionary | always | API object |
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/community/general/gitlab_user_module.html