Note
This plugin is part of the community.general collection.
To install it use: ansible-galaxy collection install community.general.
To use it in a playbook, specify: community.general.github_webhook.
The below requirements are needed on the host that executes this module.
| Parameter | Choices/Defaults | Comments |
|---|---|---|
| active boolean |
| Whether or not the hook is active |
| content_type string |
| The media type used to serialize the payloads |
| events string | A list of GitHub events the hook is triggered for. Events are listed at https://developer.github.com/v3/activity/events/types/. Required unless state is absent
| |
| github_url string | Default: "https://api.github.com" | Base URL of the GitHub API |
| insecure_ssl boolean |
| Flag to indicate that GitHub should skip SSL verification when calling the hook. |
| password string | Password to authenticate to GitHub with | |
| repository string / required | Full name of the repository to configure a hook for aliases: repo | |
| secret string | The shared secret between GitHub and the payload URL. | |
| state string |
| Whether the hook should be present or absent |
| token string | Token to authenticate to GitHub with | |
| url string / required | URL to which payloads will be delivered | |
| user string / required | User to authenticate to GitHub as |
- name: create a new webhook that triggers on push (password auth)
community.general.github_webhook:
repository: ansible/ansible
url: https://www.example.com/hooks/
events:
- push
user: "{{ github_user }}"
password: "{{ github_password }}"
- name: Create a new webhook in a github enterprise installation with multiple event triggers (token auth)
community.general.github_webhook:
repository: myorg/myrepo
url: https://jenkins.example.com/ghprbhook/
content_type: json
secret: "{{ github_shared_secret }}"
insecure_ssl: True
events:
- issue_comment
- pull_request
user: "{{ github_user }}"
token: "{{ github_user_api_token }}"
github_url: https://github.example.com
- name: Delete a webhook (password auth)
community.general.github_webhook:
repository: ansible/ansible
url: https://www.example.com/hooks/
state: absent
user: "{{ github_user }}"
password: "{{ github_password }}"
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description |
|---|---|---|
| hook_id integer | when state is 'present' | The GitHub ID of the hook created/updated Sample: 6206 |
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/community/general/github_webhook_module.html