community / community.general / 0.1.1 / module / gitlab_hook Manages GitLab project hooks. Authors: Marcus Watkins (@marwatk), Guillaume Martinez (@Lunik) preview | supported by communitycommunity.general.gitlab_hook (0.1.1) — module
Install with ansible-galaxy collection install community.general:==0.1.1
collections: - name: community.general version: 0.1.1
Adds, updates and removes project hook
- name: "Adding a project hook" gitlab_hook: api_url: https://gitlab.example.com/ api_token: "{{ access_token }}" project: "my_group/my_project" hook_url: "https://my-ci-server.example.com/gitlab-hook" state: present push_events: yes tag_push_events: yes hook_validate_certs: no token: "my-super-secret-token-that-my-ci-server-will-check"
- name: "Delete the previous hook" gitlab_hook: api_url: https://gitlab.example.com/ api_token: "{{ access_token }}" project: "my_group/my_project" hook_url: "https://my-ci-server.example.com/gitlab-hook" state: absent
- name: "Delete a hook by numeric project id" gitlab_hook: api_url: https://gitlab.example.com/ api_token: "{{ access_token }}" project: 10 hook_url: "https://my-ci-server.example.com/gitlab-hook" state: absent
state: choices: - present - absent default: present description: - When C(present) the hook will be updated to match the input or created if it doesn't exist. - When C(absent) hook will be deleted if it exists. required: true type: str token: description: - Secret token to validate hook messages at the receiver. - If this is present it will always result in a change as it cannot be retrieved from GitLab. - Will show up in the X-GitLab-Token HTTP request header. required: false type: str api_url: description: - The resolvable endpoint for the API type: str project: description: - Id or Full path of the project in the form of group/name. required: true type: str hook_url: description: - The url that you want GitLab to post to, this is used as the primary key for updates and deletion. required: true type: str api_token: description: - GitLab token for logging in. type: str job_events: default: false description: - Trigger hook on job events. type: bool note_events: default: false description: - Trigger hook on note events or when someone adds a comment. type: bool push_events: default: true description: - Trigger hook on push events. type: bool 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 issues_events: default: false description: - Trigger hook on issues events. type: bool validate_certs: default: true description: - Whether or not to validate SSL certs when supplying a https endpoint. type: bool pipeline_events: default: false description: - Trigger hook on pipeline events. type: bool tag_push_events: default: false description: - Trigger hook on tag push events. type: bool wiki_page_events: default: false description: - Trigger hook on wiki events. type: bool hook_validate_certs: aliases: - enable_ssl_verification default: false description: - Whether GitLab will do SSL verification when triggering the hook. type: bool merge_requests_events: default: false description: - Trigger hook on merge requests events. type: bool push_events_branch_filter: description: - Branch name of wildcard to trigger hook on push events type: str
error: description: the error message returned by the GitLab API returned: failed sample: '400: path is already in use' type: str hook: description: API object returned: always type: dict msg: description: Success or failure message returned: always sample: Success type: str result: description: json parsed response from the server returned: always type: dict