community / community.general / 3.8.10 / module / discord Send Discord messages | "added in version" 3.1.0 of community.general" Authors: Christian Wollinger (@cwollinger)community.general.discord (3.8.10) — module
Install with ansible-galaxy collection install community.general:==3.8.10
collections: - name: community.general version: 3.8.10
Sends a message to a Discord channel using the Discord webhook API.
- name: Send a message to the Discord channel community.general.discord: webhook_id: "00000" webhook_token: "XXXYYY" content: "This is a message from ansible"
- name: Send a message to the Discord channel with specific username and avatar community.general.discord: webhook_id: "00000" webhook_token: "XXXYYY" content: "This is a message from ansible" username: Ansible avatar_url: "https://docs.ansible.com/ansible/latest/_static/images/logo_invert.png"
- name: Send a embedded message to the Discord channel community.general.discord: webhook_id: "00000" webhook_token: "XXXYYY" embeds: - title: "Embedded message" description: "This is an embedded message" footer: text: "Author: Ansible" image: url: "https://docs.ansible.com/ansible/latest/_static/images/logo_invert.png"
- name: Send two embedded messages community.general.discord: webhook_id: "00000" webhook_token: "XXXYYY" embeds: - title: "First message" description: "This is my first embedded message" footer: text: "Author: Ansible" image: url: "https://docs.ansible.com/ansible/latest/_static/images/logo_invert.png" - title: "Second message" description: "This is my first second message" footer: text: "Author: Ansible" icon_url: "https://docs.ansible.com/ansible/latest/_static/images/logo_invert.png" fields: - name: "Field 1" value: "Value of my first field" - name: "Field 2" value: "Value of my second field" timestamp: "{{ ansible_date_time.iso8601 }}"
tts: default: false description: - Set this to C(true) if this is a TTS (Text to Speech) message. type: bool embeds: description: - Send messages as Embeds to the Discord channel. - Embeds can have a colored border, embedded images, text fields and more. - 'Allowed parameters are described in the Discord Docs: U(https://discord.com/developers/docs/resources/channel#embed-object)' - At least one of I(content) and I(embeds) must be specified. elements: dict type: list content: description: - Content of the message to the Discord channel. - At least one of I(content) and I(embeds) must be specified. type: str username: description: - Overrides the default username of the webhook. type: str avatar_url: description: - Overrides the default avatar of the webhook. type: str webhook_id: description: - The webhook ID. - 'Format from Discord webhook URL: C(/webhooks/{webhook.id}/{webhook.token}).' required: true type: str webhook_token: description: - The webhook token. - 'Format from Discord webhook URL: C(/webhooks/{webhook.id}/{webhook.token}).' required: true type: str
http_code: description: - Response Code returned by Discord API. returned: always sample: 204 type: int