diff --git a/changelogs/fragments/1176-content_type-in-mediatype.yml b/changelogs/fragments/1176-content_type-in-mediatype.yml new file mode 100644 index 000000000..8ba9e5580 --- /dev/null +++ b/changelogs/fragments/1176-content_type-in-mediatype.yml @@ -0,0 +1,2 @@ +minor_changes: + - Added content_type for email in zabbix_mediatypes diff --git a/plugins/modules/zabbix_mediatype.py b/plugins/modules/zabbix_mediatype.py index 1e2514bf3..3ec2ee495 100644 --- a/plugins/modules/zabbix_mediatype.py +++ b/plugins/modules/zabbix_mediatype.py @@ -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: @@ -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"] )) @@ -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 diff --git a/tests/integration/targets/test_zabbix_mediatype/tasks/main.yml b/tests/integration/targets/test_zabbix_mediatype/tasks/main.yml index a49166d37..3fa843797 100644 --- a/tests/integration/targets/test_zabbix_mediatype/tasks/main.yml +++ b/tests/integration/targets/test_zabbix_mediatype/tasks/main.yml @@ -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