Merge pull request #1 from ramondelafuente/feature/nsg-full-attachment-support
module guidelines compliency
This commit is contained in:
commit
df90e3b162
1 changed files with 24 additions and 12 deletions
|
@ -24,7 +24,7 @@ module: slack
|
||||||
short_description: Send Slack notifications
|
short_description: Send Slack notifications
|
||||||
description:
|
description:
|
||||||
- The M(slack) module sends notifications to U(http://slack.com) via the Incoming WebHook integration
|
- The M(slack) module sends notifications to U(http://slack.com) via the Incoming WebHook integration
|
||||||
version_added: 1.6
|
version_added: "1.6"
|
||||||
author: "Ramon de la Fuente (@ramondelafuente)"
|
author: "Ramon de la Fuente (@ramondelafuente)"
|
||||||
options:
|
options:
|
||||||
domain:
|
domain:
|
||||||
|
@ -33,6 +33,7 @@ options:
|
||||||
C(future500.slack.com)) In 1.8 and beyond, this is deprecated and may
|
C(future500.slack.com)) In 1.8 and beyond, this is deprecated and may
|
||||||
be ignored. See token documentation for information.
|
be ignored. See token documentation for information.
|
||||||
required: false
|
required: false
|
||||||
|
default: None
|
||||||
token:
|
token:
|
||||||
description:
|
description:
|
||||||
- Slack integration token. This authenticates you to the slack service.
|
- Slack integration token. This authenticates you to the slack service.
|
||||||
|
@ -48,15 +49,17 @@ options:
|
||||||
description:
|
description:
|
||||||
- Message to send.
|
- Message to send.
|
||||||
required: false
|
required: false
|
||||||
|
default: None
|
||||||
channel:
|
channel:
|
||||||
description:
|
description:
|
||||||
- Channel to send the message to. If absent, the message goes to the channel selected for the I(token).
|
- Channel to send the message to. If absent, the message goes to the channel selected for the I(token).
|
||||||
required: false
|
required: false
|
||||||
|
default: None
|
||||||
username:
|
username:
|
||||||
description:
|
description:
|
||||||
- This is the sender of the message.
|
- This is the sender of the message.
|
||||||
required: false
|
required: false
|
||||||
default: ansible
|
default: "Ansible"
|
||||||
icon_url:
|
icon_url:
|
||||||
description:
|
description:
|
||||||
- Url for the message sender's icon (default C(http://www.ansible.com/favicon.ico))
|
- Url for the message sender's icon (default C(http://www.ansible.com/favicon.ico))
|
||||||
|
@ -66,6 +69,7 @@ options:
|
||||||
- Emoji for the message sender. See Slack documentation for options.
|
- Emoji for the message sender. See Slack documentation for options.
|
||||||
(if I(icon_emoji) is set, I(icon_url) will not be used)
|
(if I(icon_emoji) is set, I(icon_url) will not be used)
|
||||||
required: false
|
required: false
|
||||||
|
default: None
|
||||||
link_names:
|
link_names:
|
||||||
description:
|
description:
|
||||||
- Automatically create links for channels and usernames in I(msg).
|
- Automatically create links for channels and usernames in I(msg).
|
||||||
|
@ -78,6 +82,7 @@ options:
|
||||||
description:
|
description:
|
||||||
- Setting for the message parser at Slack
|
- Setting for the message parser at Slack
|
||||||
required: false
|
required: false
|
||||||
|
default: None
|
||||||
choices:
|
choices:
|
||||||
- 'full'
|
- 'full'
|
||||||
- 'none'
|
- 'none'
|
||||||
|
@ -91,7 +96,7 @@ options:
|
||||||
- 'yes'
|
- 'yes'
|
||||||
- 'no'
|
- 'no'
|
||||||
color:
|
color:
|
||||||
version_added: 2.0
|
version_added: "2.0"
|
||||||
description:
|
description:
|
||||||
- Allow text to use default colors - use the default of 'normal' to not send a custom color bar at the start of the message
|
- Allow text to use default colors - use the default of 'normal' to not send a custom color bar at the start of the message
|
||||||
required: false
|
required: false
|
||||||
|
@ -105,21 +110,20 @@ options:
|
||||||
description:
|
description:
|
||||||
- Define a list of attachments. This list mirrors the Slack JSON API. For more information, see https://api.slack.com/docs/attachments
|
- Define a list of attachments. This list mirrors the Slack JSON API. For more information, see https://api.slack.com/docs/attachments
|
||||||
required: false
|
required: false
|
||||||
|
default: None
|
||||||
"""
|
"""
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
- name: Send notification message via Slack
|
- name: Send notification message via Slack
|
||||||
local_action:
|
local_action:
|
||||||
module: slack
|
module: slack
|
||||||
domain: future500.slack.com
|
token: thetoken/generatedby/slack
|
||||||
token: thetokengeneratedbyslack
|
|
||||||
msg: "{{ inventory_hostname }} completed"
|
msg: "{{ inventory_hostname }} completed"
|
||||||
|
|
||||||
- name: Send notification message via Slack all options
|
- name: Send notification message via Slack all options
|
||||||
local_action:
|
local_action:
|
||||||
module: slack
|
module: slack
|
||||||
domain: future500.slack.com
|
token: thetoken/generatedby/slack
|
||||||
token: thetokengeneratedbyslack
|
|
||||||
msg: "{{ inventory_hostname }} completed"
|
msg: "{{ inventory_hostname }} completed"
|
||||||
channel: "#ansible"
|
channel: "#ansible"
|
||||||
username: "Ansible on {{ inventory_hostname }}"
|
username: "Ansible on {{ inventory_hostname }}"
|
||||||
|
@ -129,8 +133,7 @@ EXAMPLES = """
|
||||||
|
|
||||||
- name: insert a color bar in front of the message for visibility purposes and use the default webhook icon and name configured in Slack
|
- name: insert a color bar in front of the message for visibility purposes and use the default webhook icon and name configured in Slack
|
||||||
slack:
|
slack:
|
||||||
domain: future500.slack.com
|
token: thetoken/generatedby/slack
|
||||||
token: thetokengeneratedbyslack
|
|
||||||
msg: "{{ inventory_hostname }} is alive!"
|
msg: "{{ inventory_hostname }} is alive!"
|
||||||
color: good
|
color: good
|
||||||
username: ""
|
username: ""
|
||||||
|
@ -138,8 +141,7 @@ EXAMPLES = """
|
||||||
|
|
||||||
- name: Use the attachments API
|
- name: Use the attachments API
|
||||||
slack:
|
slack:
|
||||||
domain: future500.slack.com
|
token: thetoken/generatedby/slack
|
||||||
token: thetokengeneratedbyslack
|
|
||||||
attachments:
|
attachments:
|
||||||
- text: "Display my system load on host A and B"
|
- text: "Display my system load on host A and B"
|
||||||
color: "#ff00dd"
|
color: "#ff00dd"
|
||||||
|
@ -151,6 +153,14 @@ EXAMPLES = """
|
||||||
- title: "System B"
|
- title: "System B"
|
||||||
value: "load average: 5,16, 4,64, 2,43"
|
value: "load average: 5,16, 4,64, 2,43"
|
||||||
short: "true"
|
short: "true"
|
||||||
|
|
||||||
|
- name: Send notification message via Slack (deprecated API using domian)
|
||||||
|
local_action:
|
||||||
|
module: slack
|
||||||
|
domain: future500.slack.com
|
||||||
|
token: thetokengeneratedbyslack
|
||||||
|
msg: "{{ inventory_hostname }} completed"
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
OLD_SLACK_INCOMING_WEBHOOK = 'https://%s/services/hooks/incoming-webhook?token=%s'
|
OLD_SLACK_INCOMING_WEBHOOK = 'https://%s/services/hooks/incoming-webhook?token=%s'
|
||||||
|
@ -243,4 +253,6 @@ def main():
|
||||||
# import module snippets
|
# import module snippets
|
||||||
from ansible.module_utils.basic import *
|
from ansible.module_utils.basic import *
|
||||||
from ansible.module_utils.urls import *
|
from ansible.module_utils.urls import *
|
||||||
main()
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
|
Loading…
Reference in a new issue