zabbix_template_payloads role

This role allows you to store user parameters and scripts and monitor systemd units.

Be careful: if you call this role directly, it will only install the user parameters, scripts, and the systemd unit without linking directly to Zabbix. It is better to refer to the zabbix_template_assignment role.

Variable reference

Optional variables

Variable Description Type of variable Default value Other value
zabbix_template_payloads_list list of templates dict none see bellow
zabbix_template_payloads_script_list list of scripts dict none see bellow
zabbix_template_payloads_systemd_list list of monitoring systemd unit list none see bellow

Example

In most cases (if the file is not a template) you can call the role via the meta of another role:

dependencies:
  - role: zabbix_template_payloads
    zabbix_template_payloads_list:
      - zabbix_name: OpenZFS
        user_parameter: openzfs
    zabbix_template_payloads_script_list:
      - zabbix_name: warp
        file: warp.sh
    zabbix_template_payloads_systemd_list:
      - soketie.service

In some cases, for example when defining a variable dynamically in a role, you'll need to add this step to the end of your role to call that role. Here's an example:

- name: "[zabbix_agent] manage userparameter"
  block:
  - name: "set fact zabbix_template_payloads_list"
    set_fact:
      zabbix_template_payloads_list:
        - name: OpenZFS
          user_parameter: openzfs
      zabbix_template_payloads_script_list:
        - zabbix_name: warp
          file: warp.sh
      zabbix_template_payloads_systemd_list:
        - soketie.service

  - name: "import role zabbix_template_payloads"
    import_role:
      name: zabbix_template_payloads

  - name: "unset facts"
    set_fact:
      zabbix_template_payloads_list: []
      zabbix_template_payloads_script_list: []
      zabbix_template_payloads_systemd_list: []
  tags:
    - zfs
    - zabbix
    - zabbix_template_payloads

Why create a role for this?