Skip to content

Commit

Permalink
feat(zabbix_mediatype): expose content_type field for email
Browse files Browse the repository at this point in the history
  • Loading branch information
hairmare committed Jan 29, 2024
1 parent 7c77f57 commit d6da8a8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
8 changes: 8 additions & 0 deletions plugins/modules/zabbix_mediatype.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@
- SSL verify peer for SMTP.
- Can be specified when I(smtp_security=STARTTLS) or I(smtp_security=SSL/TLS)
default: false
content_type:
type: "int"
description:
- Can be used when I(type=email).
- Message format.
- Possible values are 0 = plain text or 1 (default) = html.
message_text_limit:
type: "str"
description:
Expand Down Expand Up @@ -525,6 +531,7 @@ def construct_parameters(self):
smtp_authentication=truths.get(str(self._module.params["smtp_authentication"])),
smtp_verify_host=truths.get(str(self._module.params["smtp_verify_host"])),
smtp_verify_peer=truths.get(str(self._module.params["smtp_verify_peer"])),
content_type=self._module.params["content_type"],
username=self._module.params["username"],
passwd=self._module.params["password"]
))
Expand Down Expand Up @@ -693,6 +700,7 @@ def main():
smtp_authentication=dict(type="bool", default=False, required=False),
smtp_verify_host=dict(type="bool", default=False, required=False),
smtp_verify_peer=dict(type="bool", default=False, required=False),
content_type=dict(type="int", default=1, required=False),
# EZ Text
message_text_limit=dict(type="str", required=False, choices=["USA", "Canada"]),
# Webhook
Expand Down
23 changes: 23 additions & 0 deletions tests/integration/targets/test_zabbix_mediatype/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,29 @@
- ansible.builtin.assert:
that: zbxmediatype_reset.changed is sameas True

- name: test - check email mediatype content_type for html default
community.zabbix.zabbix_mediatype:
content_type: 1
register: zbxmediatype_verif

- ansible.builtin.assert:
that: zbxmediatype_verif.changed is sameas False

- name: test - update email mediatype content_type to plain default
community.zabbix.zabbix_mediatype:
content_type: 0
register: zbxmediatype_verif

- ansible.builtin.assert:
that: zbxmediatype_verif.changed is sameas True

- name: test - reset email mediatype content_type to default
community.zabbix.zabbix_mediatype:
register: zbxmediatype_reset

- ansible.builtin.assert:
that: zbxmediatype_reset.changed is sameas True

- name: test - update email mediatype concurrent settings
community.zabbix.zabbix_mediatype:
max_sessions: 99
Expand Down

0 comments on commit d6da8a8

Please sign in to comment.