mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 03:11:24 -07:00
* Add additional auth support to Gitlab (#705) - removed unused imports from module_utils.gitlab - fix bug in gitlab_project to check if avatar_path is provided * add doc_fragment and argument_spec for gitlab auth * doc fixes and remove avatar_path bug fix * small doc changes, pass validate_certs to requests call * update changelog
This commit is contained in:
parent
11fcf661bf
commit
52ad0a5fbb
15 changed files with 298 additions and 250 deletions
|
@ -23,13 +23,10 @@ requirements:
|
|||
- python >= 2.7
|
||||
- python-gitlab python module
|
||||
extends_documentation_fragment:
|
||||
- community.general.auth_basic
|
||||
- community.general.auth_basic
|
||||
- community.general.gitlab
|
||||
|
||||
options:
|
||||
api_token:
|
||||
description:
|
||||
- GitLab token for logging in.
|
||||
type: str
|
||||
group:
|
||||
description:
|
||||
- Id or the full path of the group of which this projects belongs to.
|
||||
|
@ -209,6 +206,19 @@ EXAMPLES = r'''
|
|||
initialize_with_readme: true
|
||||
state: present
|
||||
delegate_to: localhost
|
||||
|
||||
- name: get the initial root password
|
||||
ansible.builtin.shell: |
|
||||
grep 'Password:' /etc/gitlab/initial_root_password | sed -e 's/Password\: \(.*\)/\1/'
|
||||
register: initial_root_password
|
||||
|
||||
- name: Create a GitLab Project using a username/password via oauth_token
|
||||
community.general.gitlab_project:
|
||||
api_url: https://gitlab.example.com/
|
||||
api_username: root
|
||||
api_password: "{{ initial_root_password }}"
|
||||
name: my_second_project
|
||||
group: "10481470"
|
||||
'''
|
||||
|
||||
RETURN = r'''
|
||||
|
@ -249,7 +259,7 @@ from ansible.module_utils.api import basic_auth_argument_spec
|
|||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import find_group, find_project, gitlab_authentication
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import auth_argument_spec, find_group, find_project, gitlab_authentication
|
||||
|
||||
|
||||
class GitLabProject(object):
|
||||
|
@ -386,8 +396,8 @@ class GitLabProject(object):
|
|||
|
||||
def main():
|
||||
argument_spec = basic_auth_argument_spec()
|
||||
argument_spec.update(auth_argument_spec())
|
||||
argument_spec.update(dict(
|
||||
api_token=dict(type='str', no_log=True),
|
||||
group=dict(type='str'),
|
||||
name=dict(type='str', required=True),
|
||||
path=dict(type='str'),
|
||||
|
@ -419,14 +429,17 @@ def main():
|
|||
argument_spec=argument_spec,
|
||||
mutually_exclusive=[
|
||||
['api_username', 'api_token'],
|
||||
['api_password', 'api_token'],
|
||||
['api_username', 'api_oauth_token'],
|
||||
['api_username', 'api_job_token'],
|
||||
['api_token', 'api_oauth_token'],
|
||||
['api_token', 'api_job_token'],
|
||||
['group', 'username'],
|
||||
],
|
||||
required_together=[
|
||||
['api_username', 'api_password'],
|
||||
],
|
||||
required_one_of=[
|
||||
['api_username', 'api_token']
|
||||
['api_username', 'api_token', 'api_oauth_token', 'api_job_token']
|
||||
],
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue