mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-08 22:30:04 -07:00
Enhancement to gitlab_group_members to accept user lists as input (#3047)
* - fix to issue 3041 - add func to work with user lists - add func to set members to the ones give * Added version_added to new parameter * fixed elements in definition of gitlab_users nad wrong import in gitlab_users * linter issues fixed * added list elelements to argument_spec * More whitspeaces for the linter * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * adapted changelog * removed bugfix (other PR), changes due to review * changed input handling according to review * Fixed test findings * Added list of dict to allow for specifying user/access_level tuples * corrected doc section * fixed parameter definitions * removed strange additional import * Update changelogs/fragments/3041-gitlab_x_members_fix_and_enhancement.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_project_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * fixed required if * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Added suggestions from PR * fixed identation problem * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Zainab Alsaffar <za5775@rit.edu> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Zainab Alsaffar <za5775@rit.edu> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Recommended changes from discussionst * Fixed issues from automatic tests * added missing metaclass due to test finding * added integration tests * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * fixed optimization for only one user * Reverted gitlab_project_members to original version - changes will be done in a separate branch * added examples for new functionality * - fixed changelog after reverting gitlab_project_memebers - fully reverted gitlab_project_members * Fixed error handling: when single users are not updateable in bulk mode the exception should not stop the code flow but document the problem in the result. * Better error handling * on error give username, not gitlab numeric userid * Fixed broken check_mode * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Change from review Co-authored-by: Max Bidlingmaier <Max-Florian.Bidlingmaier@sap.com> Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Zainab Alsaffar <za5775@rit.edu>
This commit is contained in:
parent
1f5345881d
commit
fce562ad6d
4 changed files with 311 additions and 79 deletions
|
@ -13,7 +13,7 @@
|
|||
state: present
|
||||
|
||||
- name: Add a User to A GitLab Group
|
||||
gitlab_group_members:
|
||||
gitlab_group_members:
|
||||
api_url: '{{ gitlab_server_url }}'
|
||||
api_token: '{{ gitlab_api_access_token }}'
|
||||
gitlab_group: '{{ gitlab_group_name }}'
|
||||
|
@ -27,4 +27,47 @@
|
|||
api_token: '{{ gitlab_api_access_token }}'
|
||||
gitlab_group: '{{ gitlab_group_name }}'
|
||||
gitlab_user: '{{ username }}'
|
||||
state: absent
|
||||
state: absent
|
||||
|
||||
- name: Add a list of Users to A GitLab Group
|
||||
gitlab_group_members:
|
||||
api_url: '{{ gitlab_server_url }}'
|
||||
api_token: '{{ gitlab_api_access_token }}'
|
||||
gitlab_group: '{{ gitlab_group_name }}'
|
||||
gitlab_user: '{{ userlist }}'
|
||||
access_level: '{{ gitlab_access_level }}'
|
||||
state: present
|
||||
|
||||
- name: Remove a list of Users to A GitLab Group
|
||||
gitlab_group_members:
|
||||
api_url: '{{ gitlab_server_url }}'
|
||||
api_token: '{{ gitlab_api_access_token }}'
|
||||
gitlab_group: '{{ gitlab_group_name }}'
|
||||
gitlab_user: '{{ userlist }}'
|
||||
state: absent
|
||||
|
||||
- name: Add a list of Users with Dedicated Access Levels to A GitLab Group
|
||||
gitlab_group_members:
|
||||
api_url: '{{ gitlab_server_url }}'
|
||||
api_token: '{{ gitlab_api_access_token }}'
|
||||
gitlab_group: '{{ gitlab_group_name }}'
|
||||
gitlab_users_access: '{{ dedicated_access_users }}'
|
||||
state: present
|
||||
|
||||
- name: Remove a list of Users with Dedicated Access Levels to A GitLab Group
|
||||
gitlab_group_members:
|
||||
api_url: '{{ gitlab_server_url }}'
|
||||
api_token: '{{ gitlab_api_access_token }}'
|
||||
gitlab_group: '{{ gitlab_group_name }}'
|
||||
gitlab_users_access: '{{ dedicated_access_users }}'
|
||||
state: absent
|
||||
|
||||
- name: Add a user, remove all others which might be on this access level
|
||||
gitlab_group_members:
|
||||
api_url: '{{ gitlab_server_url }}'
|
||||
api_token: '{{ gitlab_api_access_token }}'
|
||||
gitlab_group: '{{ gitlab_group_name }}'
|
||||
gitlab_user: '{{ username }}'
|
||||
access_level: '{{ gitlab_access_level }}'
|
||||
pruge_users: '{{ gitlab_access_level }}'
|
||||
state: present
|
||||
|
|
|
@ -2,4 +2,12 @@ gitlab_server_url: https://gitlabserver.example.com
|
|||
gitlab_api_access_token: 126hngbscx890cv09b
|
||||
gitlab_group_name: groupname1
|
||||
username: username1
|
||||
gitlab_access_level: developer
|
||||
gitlab_access_level: developer
|
||||
userlist:
|
||||
- username1
|
||||
- username2
|
||||
dedicated_access_users:
|
||||
- name: username1
|
||||
access_level: "developer"
|
||||
- name: username2
|
||||
access_level: "maintainer"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue