community / community.general / 8.5.0 / module / gitlab_hook Manages GitLab project hooks Authors: Marcus Watkins (@marwatk), Guillaume Martinez (@Lunik)community.general.gitlab_hook (8.5.0) — module
Install with ansible-galaxy collection install community.general:==8.5.0
collections: - name: community.general version: 8.5.0
Adds, updates and removes project hook
- name: "Adding a project hook" community.general.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: true tag_push_events: true token: "my-super-secret-token-that-my-ci-server-will-check"
- name: "Delete the previous hook" community.general.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" community.general.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 V(present) the hook will be updated to match the input or created if it doesn't exist. - When V(absent) hook will be deleted if it exists. 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 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 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 access token with API permissions. 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 api_job_token: description: - GitLab CI job token for logging in. type: str version_added: 4.2.0 version_added_collection: community.general 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 api_oauth_token: description: - GitLab OAuth token for logging in. type: str version_added: 4.2.0 version_added_collection: community.general pipeline_events: default: false description: - Trigger hook on pipeline events. type: bool releases_events: description: - Trigger hook on release events. type: bool version_added: 8.4.0 version_added_collection: community.general 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: default: '' description: - Branch name of wildcard to trigger hook on push events type: str version_added: 0.2.0 version_added_collection: community.general
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