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 Feb 1, 2024
1 parent 21ea598 commit d4149c4
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/1176-content_type-in-mediatype.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- Added content_type for email in zabbix_mediatypes
9 changes: 9 additions & 0 deletions plugins/modules/zabbix_mediatype.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@
- 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 = html.
default: "1"
message_text_limit:
type: "str"
description:
Expand Down Expand Up @@ -525,6 +532,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 +701,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 d4149c4

Please sign in to comment.