ansible.builtin.github_webhook (v2.9.27) — module

Manage GitHub webhooks

| "added in version" 2.8 of ansible.builtin"

Authors: Chris St. Pierre (@stpierre)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

Create and delete GitHub webhooks


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name:  create a new webhook that triggers on push (password auth)
  github_webhook:
    repository: ansible/ansible
    url: https://www.example.com/hooks/
    events:
      - push
    user: "{{ github_user }}"
    password: "{{ github_password }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: create a new webhook in a github enterprise installation with multiple event triggers (token auth)
  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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: delete a webhook (password auth)
  github_webhook:
    repository: ansible/ansible
    url: https://www.example.com/hooks/
    state: absent
    user: "{{ github_user }}"
    password: "{{ github_password }}"

Inputs

    
url:
    description:
    - URL to which payloads will be delivered
    required: true

user:
    description:
    - User to authenticate to GitHub as
    required: true

state:
    choices:
    - absent
    - present
    default: present
    description:
    - Whether the hook should be present or absent
    required: false

token:
    description:
    - Token to authenticate to GitHub with
    required: false

active:
    default: true
    description:
    - Whether or not the hook is active
    required: false
    type: bool

events:
    description:
    - 'A list of GitHub events the hook is triggered for. Events are listed at U(https://developer.github.com/v3/activity/events/types/).
      Required unless C(state) is C(absent)

      '
    required: false

secret:
    description:
    - The shared secret between GitHub and the payload URL.
    required: false

password:
    description:
    - Password to authenticate to GitHub with
    required: false

github_url:
    default: https://api.github.com
    description:
    - Base URL of the GitHub API
    required: false

repository:
    aliases:
    - repo
    description:
    - Full name of the repository to configure a hook for
    required: true

content_type:
    choices:
    - form
    - json
    default: form
    description:
    - The media type used to serialize the payloads
    required: false

insecure_ssl:
    default: false
    description:
    - 'Flag to indicate that GitHub should skip SSL verification when calling the hook.

      '
    required: false
    type: bool

Outputs

hook_id:
  description: The GitHub ID of the hook created/updated
  returned: when state is 'present'
  sample: 6206
  type: int