community / community.general / 8.5.0 / module / gitlab_group_members Manage group members on GitLab Server | "added in version" 1.2.0 of community.general" Authors: Zainab Alsaffar (@zanssa)community.general.gitlab_group_members (8.5.0) — module
Install with ansible-galaxy collection install community.general:==8.5.0
collections: - name: community.general version: 8.5.0
This module allows to add and remove members to/from a group, or change a member's access level in a group on GitLab.
- name: Add a user to a GitLab Group community.general.gitlab_group_members: api_url: 'https://gitlab.example.com' api_token: 'Your-Private-Token' gitlab_group: groupname gitlab_user: username access_level: developer state: present
- name: Remove a user from a GitLab Group community.general.gitlab_group_members: api_url: 'https://gitlab.example.com' api_token: 'Your-Private-Token' gitlab_group: groupname gitlab_user: username state: absent
- name: Add a list of Users to A GitLab Group community.general.gitlab_group_members: api_url: 'https://gitlab.example.com' api_token: 'Your-Private-Token' gitlab_group: groupname gitlab_user: - user1 - user2 access_level: developer state: present
- name: Add a list of Users with Dedicated Access Levels to A GitLab Group community.general.gitlab_group_members: api_url: 'https://gitlab.example.com' api_token: 'Your-Private-Token' gitlab_group: groupname gitlab_users_access: - name: user1 access_level: developer - name: user2 access_level: maintainer state: present
- name: Add a user, remove all others which might be on this access level community.general.gitlab_group_members: api_url: 'https://gitlab.example.com' api_token: 'Your-Private-Token' gitlab_group: groupname gitlab_user: username access_level: developer pruge_users: developer state: present
- name: Remove a list of Users with Dedicated Access Levels to A GitLab Group community.general.gitlab_group_members: api_url: 'https://gitlab.example.com' api_token: 'Your-Private-Token' gitlab_group: groupname gitlab_users_access: - name: user1 access_level: developer - name: user2 access_level: maintainer state: absent
state: choices: - present - absent default: present description: - State of the member in the group. - On V(present), it adds a user to a GitLab group. - On V(absent), it removes a user from a GitLab group. type: str api_url: description: - The resolvable endpoint for the API. type: str ca_path: description: - The CA certificates bundle to use to verify GitLab server certificate. type: str version_added: 8.1.0 version_added_collection: community.general api_token: description: - GitLab access token with API permissions. type: str gitlab_user: description: - A username or a list of usernames to add to/remove from the GitLab group. - Mutually exclusive with O(gitlab_users_access). elements: str type: list purge_users: choices: - guest - reporter - developer - maintainer - owner description: - Adds/remove users of the given access_level to match the given O(gitlab_user)/O(gitlab_users_access) list. If omitted do not purge orphaned members. - Is only used when O(state=present). elements: str type: list version_added: 3.6.0 version_added_collection: community.general access_level: choices: - guest - reporter - developer - maintainer - owner description: - The access level for the user. - Required if O(state=present), user state is set to present. - Mutually exclusive with O(gitlab_users_access). 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 gitlab_group: description: - The C(full_path) of the GitLab group the member is added to/removed from. - Setting this to C(name) or C(path) has been disallowed since community.general 6.0.0. Use C(full_path) instead. required: true type: str api_job_token: description: - GitLab CI job token for logging in. type: str version_added: 4.2.0 version_added_collection: community.general validate_certs: default: true description: - Whether or not to validate SSL certs when supplying a HTTPS endpoint. type: bool api_oauth_token: description: - GitLab OAuth token for logging in. type: str version_added: 4.2.0 version_added_collection: community.general gitlab_users_access: description: - Provide a list of user to access level mappings. - Every dictionary in this list specifies a user (by username) and the access level the user should have. - Mutually exclusive with O(gitlab_user) and O(access_level). - Use together with O(purge_users) to remove all users not specified here from the group. elements: dict suboptions: access_level: choices: - guest - reporter - developer - maintainer - owner description: - The access level for the user. - Required if O(state=present), user state is set to present. required: true type: str name: description: A username or a list of usernames to add to/remove from the GitLab group. required: true type: str type: list version_added: 3.6.0 version_added_collection: community.general