mattermost: add support for message priority (#9087)
* mattermost: add support for message priority * Add changelog fragment * Consistency nit in changelog Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Validate priority arg and doc fixes Validate the two possible priorities with choices. Add priority arg to one example and add version_added field for the arg docs. * Update changelog. --------- Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> Co-authored-by: Felix Fontein <felix@fontein.de>pull/9098/head
parent
3d03c373ff
commit
94e3635c0a
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- mattermost - adds support for message priority (https://github.com/ansible-collections/community.general/issues/9068, https://github.com/ansible-collections/community.general/pull/9087).
|
|
@ -62,13 +62,19 @@ options:
|
||||||
username:
|
username:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
- This is the sender of the message (Username Override need to be enabled by mattermost admin, see mattermost doc.
|
- This is the sender of the message (Username Override need to be enabled by mattermost admin, see mattermost doc).
|
||||||
default: Ansible
|
default: Ansible
|
||||||
icon_url:
|
icon_url:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
- URL for the message sender's icon.
|
- URL for the message sender's icon.
|
||||||
default: https://docs.ansible.com/favicon.ico
|
default: https://docs.ansible.com/favicon.ico
|
||||||
|
priority:
|
||||||
|
type: str
|
||||||
|
description:
|
||||||
|
- Set a priority for the message.
|
||||||
|
choices: [ important, urgent ]
|
||||||
|
version_added: 10.0.0
|
||||||
validate_certs:
|
validate_certs:
|
||||||
description:
|
description:
|
||||||
- If V(false), SSL certificates will not be validated. This should only be used
|
- If V(false), SSL certificates will not be validated. This should only be used
|
||||||
|
@ -92,6 +98,7 @@ EXAMPLES = """
|
||||||
channel: notifications
|
channel: notifications
|
||||||
username: 'Ansible on {{ inventory_hostname }}'
|
username: 'Ansible on {{ inventory_hostname }}'
|
||||||
icon_url: http://www.example.com/some-image-file.png
|
icon_url: http://www.example.com/some-image-file.png
|
||||||
|
priority: important
|
||||||
|
|
||||||
- name: Send attachments message via Mattermost
|
- name: Send attachments message via Mattermost
|
||||||
community.general.mattermost:
|
community.general.mattermost:
|
||||||
|
@ -135,6 +142,7 @@ def main():
|
||||||
channel=dict(type='str', default=None),
|
channel=dict(type='str', default=None),
|
||||||
username=dict(type='str', default='Ansible'),
|
username=dict(type='str', default='Ansible'),
|
||||||
icon_url=dict(type='str', default='https://docs.ansible.com/favicon.ico'),
|
icon_url=dict(type='str', default='https://docs.ansible.com/favicon.ico'),
|
||||||
|
priority=dict(type='str', default=None, choices=['important', 'urgent']),
|
||||||
validate_certs=dict(default=True, type='bool'),
|
validate_certs=dict(default=True, type='bool'),
|
||||||
attachments=dict(type='list', elements='dict'),
|
attachments=dict(type='list', elements='dict'),
|
||||||
),
|
),
|
||||||
|
@ -154,6 +162,8 @@ def main():
|
||||||
for param in ['text', 'channel', 'username', 'icon_url', 'attachments']:
|
for param in ['text', 'channel', 'username', 'icon_url', 'attachments']:
|
||||||
if module.params[param] is not None:
|
if module.params[param] is not None:
|
||||||
payload[param] = module.params[param]
|
payload[param] = module.params[param]
|
||||||
|
if module.params['priority'] is not None:
|
||||||
|
payload['priority'] = {'priority': module.params['priority']}
|
||||||
|
|
||||||
payload = module.jsonify(payload)
|
payload = module.jsonify(payload)
|
||||||
result['payload'] = payload
|
result['payload'] = payload
|
||||||
|
|
Loading…
Reference in New Issue