Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for Macros Description in zabbix_template Module #1100

Open
shaiajneh opened this issue Oct 12, 2023 · 0 comments
Open

Add Support for Macros Description in zabbix_template Module #1100

shaiajneh opened this issue Oct 12, 2023 · 0 comments
Labels
bug Something isn't working module The issue or pull request is related to Zabbix module

Comments

@shaiajneh
Copy link

SUMMARY

Updating current macros on a template will remove the description.

ISSUE TYPE
  • Feature Idea
    We need to be able to update the macros on templates without it clearing the description of the macro (add description arguemnt).
COMPONENT NAME

zabbix_template module

ADDITIONAL INFORMATION
- name: Create Test Template
  community.zabbix.zabbix_template:
    template_json:
      zabbix_export:
        version: "6.4"
        templates:
          - name: Template for Testing
            uuid: 63ba665582334ce6b8077c9bf7a3763f
            description: "Testing template import"
            template: Test Template
            groups:
              - name: Templates
            macros:
              - macro: '{$TEST}'
                value: "123"
                description:  "Macro Description"
    state: present

- name: Get Template
  community.zabbix.zabbix_template_info:
    template_name: "Test Template"
    format: json
    omit_date: no
  register: template_json

- name: Print Macro Before Modification
  debug:
    msg: "{{ template_json.template_json.zabbix_export.templates | selectattr('macros') }}"

- name: Modify Macro
  community.zabbix.zabbix_template:
    template_name: "Test Template"
    macros:
      - macro: '{$TEST}'
        value: "12345"

- name: Get Template After Modification
  community.zabbix.zabbix_template_info:
    template_name: "Test Template"
    format: json
    omit_date: no
  register: template_json_after

- name: Print Macro After Modification
  debug:
    msg: "{{ template_json_after.template_json.zabbix_export.templates | selectattr('macros') }}"

Output


TASK [zabbix : Create Test Template] *******************************************************************************************************************************************************************************************************************************************************************************
changed: [localhost]

TASK [zabbix : Get Template] ***************************************************************************************************************************************************************************************************************************************************************************************
ok: [localhost]

TASK [zabbix : Print Macro Before Modification] ********************************************************************************************************************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": [
        {
            "description": "Testing template import",
            "groups": [
                {
                    "name": "Templates"
                }
            ],
            "macros": [
                {
                    "description": "Macro Description",
                    "macro": "{$TEST}",
                    "value": "123"
                }
            ],
            "name": "Template for Testing",
            "template": "Test Template",
            "uuid": "63ba665582334ce6b8077c9bf7a3763f"
        }
    ]
}

TASK [zabbix : Modify Macro] ***************************************************************************************************************************************************************************************************************************************************************************************
changed: [localhost]

TASK [zabbix : Get Template After Modification] ********************************************************************************************************************************************************************************************************************************************************************
ok: [localhost]

TASK [zabbix : Print Macro After Modification] *********************************************************************************************************************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": [
        {
            "description": "Testing template import",
            "groups": [
                {
                    "name": "Templates"
                }
            ],
            "macros": [
                {
                    "macro": "{$TEST}",
                    "value": "12345"
                }
            ],
            "name": "Template for Testing",
            "template": "Test Template",
            "uuid": "63ba665582334ce6b8077c9bf7a3763f"
        }
    ]
}



@pyrodie18 pyrodie18 added bug Something isn't working module The issue or pull request is related to Zabbix module labels Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working module The issue or pull request is related to Zabbix module
Projects
None yet
Development

No branches or pull requests

2 participants