GithubHelp home page GithubHelp logo

ansible-collections / community.zabbix Goto Github PK

View Code? Open in Web Editor NEW
305.0 19.0 259.0 2.09 MB

Zabbix Ansible modules

Home Page: http://galaxy.ansible.com/community/zabbix

License: Other

Python 92.12% Jinja 7.88%
ansible-collection zabbix ansible hacktoberfest

community.zabbix's Introduction

Zabbix collection for Ansible

Plugins:

plugins repo-sanity

Roles:

Zabbix Agent Zabbix Server Zabbix Proxy Zabbix Web Zabbix Javagateway

Table of Contents

Introduction

This repo hosts the community.zabbix Ansible Collection.

The collection includes a variety of Ansible content to help automate the management of resources in Zabbix.

Included content

Click on the name of a plugin or module to view that content's documentation:

Installation

Requirements

Each component in this collection requires additional dependencies. Review components you are interested in by visiting links present in the Included content section.

This is especially important for some of the Zabbix roles that require you to install additional standalone roles from Ansible Galaxy.

For the majority of modules, however, you can get away with just:

Ansible 2.10 and higher

With the release of Ansible 2.10, modules have been moved into collections. With the exception of ansible.builtin modules, this means additonal collections must be installed in order to use modules such as seboolean (now ansible.posix.seboolean). The following collections are now frequently required: ansible.posix and community.general. Installing the collections:

ansible-galaxy collection install ansible.posix
ansible-galaxy collection install community.general
ansible-galaxy collection install ansible.netcommon

Installing the Collection from Ansible Galaxy

Before using the Zabbix collection, you need to install it with the Ansible Galaxy CLI:

ansible-galaxy collection install community.zabbix

You can also include it in a requirements.yml file along with other required collections and install them via ansible-galaxy collection install -r requirements.yml, using the format:

---
collections:
  - name: community.zabbix
    version: 2.3.1
  - name: ansible.posix
    version: 1.3.0
  - name: community.general
    version: 3.7.0

Upgrading collection

Make sure to read UPGRADE document before installing newer version of this collection.

Usage

Please note that these are not working examples. For documentation on how to use content included in this collection, refer to the links in the Included content section.

To use a module or role from this collection, reference them with their Fully Qualified Collection Namespace (FQCN) like so:

---
- name: Using Zabbix collection to install Zabbix Agent
  hosts: localhost
  roles:
    - role: community.zabbix.zabbix_agent
      zabbix_agent_server: zabbix.example.com
      ...

- name: If Zabbix WebUI runs on non-default (zabbix) path, e.g. http://<FQDN>/zabbixeu
  ansible.builtin.set_fact:
    ansible_zabbix_url_path: 'zabbixeu'

- name: Using Zabbix collection to manage Zabbix Server's elements with username/password
  hosts: zabbix.example.com
  vars:
    ansible_network_os: community.zabbix.zabbix
    ansible_connection: httpapi
    ansible_httpapi_port: 80
    ansible_httpapi_use_ssl: false  # Set to true for HTTPS
    ansible_httpapi_validate_certs: false  # For HTTPS et to true to validate server's certificate
    ansible_user: Admin
    ansible_httpapi_pass: zabbix
  tasks:
    - name: Ensure host is monitored by Zabbix
      community.zabbix.zabbix_host:
        ...

- name: Using Zabbix collection to manage Zabbix Server's elements with authentication key
  hosts: zabbix.example.net
  vars:
    ansible_network_os: community.zabbix.zabbix
    ansible_connection: httpapi
    ansible_httpapi_port: 80
    ansible_httpapi_use_ssl: false  # Set to true for HTTPS
    ansible_httpapi_validate_certs: false  # For HTTPS set to true to validate server's certificate
    ansible_zabbix_auth_key: 8ec0d52432c15c91fcafe9888500cf9a607f44091ab554dbee860f6b44fac895
  tasks:
    - name: Ensure host is monitored by Zabbix
      community.zabbix.zabbix_host:
        ...

Or you include collection name community.zabbix in the playbook's collections element, like this:

---
- name: Using Zabbix collection
  hosts: localhost
  collections:
    - community.zabbix

  roles:
    - role: zabbix_agent
      zabbix_agent_server: zabbix.example.com
      ...

- name: Using Zabbix collection to manage Zabbix Server's elements with username/password
  hosts: zabbix.example.com
  vars:
    ansible_network_os: community.zabbix.zabbix
    ansible_connection: httpapi
    ansible_httpapi_port: 80
    ansible_httpapi_use_ssl: false  # Set to true for HTTPS
    ansible_httpapi_validate_certs: false  # For HTTPS et to true to validate server's certificate
    ansible_user: Admin
    ansible_httpapi_pass: zabbix
  tasks:
    - name: Ensure host is monitored by Zabbix
      zabbix.zabbix_host:
        ...

- name: Using Zabbix collection to manage Zabbix Server's elements with authentication key
  hosts: zabbix.example.net
  vars:
    ansible_network_os: community.zabbix.zabbix
    ansible_connection: httpapi
    ansible_httpapi_port: 80
    ansible_httpapi_use_ssl: false  # Set to true for HTTPS
    ansible_httpapi_validate_certs: false  # For HTTPS et to true to validate server's certificate
    ansible_zabbix_auth_key: 8ec0d52432c15c91fcafe9888500cf9a607f44091ab554dbee860f6b44fac895
  tasks:
    - name: Ensure host is monitored by Zabbix
      community.zabbix.zabbix_host:
        ...

If Basic Authentication is required to access Zabbix server add following variables:

zabbix_api_http_user: "user"
zabbix_api_http_password: "password"

Supported Zabbix versions

Main priority is to support Zabbix releases which have official full support from Zabbix LLC. Please checkout the versions at Zabbix Life Cycle & Release Policy page.

Support for Zabbix LTS versions will be dropped with Major releases of the collection and mostly affect modules. Each role is following its unique support matrix. You should always consult documentation of roles in docs/ directory.

If you find any inconsistencies with the version of Zabbix you are using, feel free to open a pull request or an issue and we will try to address it as soon as possible. In case of pull requests, please make sure that your changes will not break any existing functionality for currently supported Zabbix releases.

Collection life cycle and support

See RELEASE document for more information regarding life cycle and support for the collection.

Contributing

See CONTRIBUTING for more information about how to contribute to this repository.

Please also feel free to stop by our Gitter community.

License

GNU General Public License v3.0 or later

See LICENSE to see the full text.

community.zabbix's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

community.zabbix's Issues

zabbix repository listed twice when a previous installation from package exists

SUMMARY

During the Zabbix Agent installation on RedHat/Centos, the official package "zabbix-release-{{zabbix_agent_version}}-1.el{{distribution_version_...}}.noarch.rpm" is not used, instead two files are created.

These files conflict with an existing installation from package, because zabbix-non-supported is listed twice:

  • zabbix.repo - lists both repos when created by rpm, and only one when created from role
  • zabbix-non-supported.repo, created by role

Use of the package could be a better option (personally i'd prefer this). Or specify "file" in "yum_repository" module, also.

Example log:

# yum search zabbix-agent
Loaded plugins: fastestmirror
Repository zabbix-non-supported is listed more than once in the configuration
...
ISSUE TYPE
  • Feature Idea
COMPONENT NAME

- name: "RedHat | Install basic repo file"

About the module name in the Example block

SUMMARY

The module name of the example block of existing modules is not FQCN.
I think I should change the module name to FQCN.

For example, before

- name: Get Zabbix template as JSON
  zabbix_template_info:
(snip)

after

- name: Get Zabbix template as JSON
  community.zabbix.zabbix_template_info:
(snip)
ISSUE TYPE
  • Documentation Report
COMPONENT NAME
ANSIBLE VERSION

zabbix_host module digital envelope routines: EVP_DigestInit_ex disabled for FIPS

SUMMARY

Using zabbix_host module to create a host from RHEL 8 with FIPS mode enabled produces an error because MD5 is used hash the password before it's printed in the debug log.

(this is a re-post of issue ansible/ansible/issues/68351 as instructed)

ISSUE TYPE
  • Bug Report
COMPONENT NAME

zabbix_host

ANSIBLE VERSION
ansible 2.9.6
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/username/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/username/.local/lib/python3.6/site-packages/ansible
  executable location = /home/username/.local/bin/ansible
  python version = 3.6.8 (default, Oct 11 2019, 15:04:54) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]
CONFIGURATION
ANSIBLE_NOCOWS(/etc/ansible/ansible.cfg) = True
ANSIBLE_SSH_ARGS(/etc/ansible/ansible.cfg) = -o ControlMaster=no
DEFAULT_FORKS(/etc/ansible/ansible.cfg) = 4
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
OS / ENVIRONMENT

crypto.fips_enabled = 1

STEPS TO REPRODUCE
  • Install RHEL8
  • Enable FIPS mode
  • Run playbook
- name: Create a new host or update an existing host's info
  delegate_to: localhost
  zabbix_host:
    server_url: https://{{ zabbix_main_server }}
    login_user: "{{ zabbix_user }}"
    login_password: "{{ zabbix_password }}"
    host_name: "{{ inventory_hostname }}"
    visible_name: "{{ inventory_hostname }}"
    host_groups:
      - "{{ zabbix_host_groups }}"
    link_templates:
      - "{{ zabbix_link_template }}"
    status: enabled
    state: present
    inventory_mode: automatic
    interfaces:
      - type: 1
        main: 1
        useip: 1
        ip: "{{ ansible_default_ipv4.address }}"
        dns: "{{ inventory_hostname }}"
        port: "{{ zabbix_port | default(10050) }}"
    tls_connect: 2
    tls_accept: 2
    tls_psk_identity: "PSK-{{ inventory_hostname }}"
    tls_psk: "{{ zabbix_psk.stdout }}"
    proxy: "{{ zabbix_proxy | default(omit) }}"
  become: false
EXPECTED RESULTS

Sucessful execution

ACTUAL RESULTS

Error: Failed to connect to Zabbix server: [digital envelope routines: EVP_DigestInit_ex] disabled for FIPS

The full traceback is:
  File "/tmp/ansible_zabbix_host_payload_m45eq3kv/ansible_zabbix_host_payload.zip/ansible/modules/monitoring/zabbix/zabbix_host.py", line 767, in main
  File "/home/username/.local/lib/python3.6/site-packages/zabbix_api.py", line 203, in login
    hashed_pw_string = "md5(" + hashlib.md5(l_password.encode('utf-8')).hexdigest() + ")"
fatal: [[email protected] -> localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "ca_cert": null,
            "description": null,
            "force": true,
            "host_groups": [
                "Default"
            ],
            "host_name": "[email protected]",
            "http_login_password": null,
            "http_login_user": null,
            "interfaces": [
                {
                    "dns": "[email protected]",
                    "ip": "10.220.37.193",
                    "main": 1,
                    "port": "10050",
                    "type": 1,
                    "useip": 1
                }
            ],
            "inventory_mode": "automatic",
            "inventory_zabbix": null,
            "ipmi_authtype": null,
            "ipmi_password": null,
            "ipmi_privilege": null,
            "ipmi_username": null,
            "link_templates": [
                "UFST - Linux OS"
            ],
            "login_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "login_user": "zabbix_api",
            "proxy": "zabproxy.domain.local",
            "server_url": "https://zabbix.domain.local",
            "state": "present",
            "status": "enabled",
            "timeout": 10,
            "tls_accept": 2,
            "tls_connect": 2,
            "tls_psk": "86f9eaba1ed321758388348a2233daf2f6f9889dcbdbeaa913950ad21bb22f31",
            "tls_psk_identity": "[email protected]",
            "tls_subject": null,
            "validate_certs": true,
            "visible_name": "[email protected]"
        }
    },
    "msg": "Failed to connect to Zabbix server: [digital envelope routines: EVP_DigestInit_ex] disabled for FIPS"
}

I've opened a PR for the upstream zabbix_api package here: gescheit/scripts#34

But until it's fixed the zabbix_host module doesn't work for me with above configuration, so I figured I'd log the issue here.

host.create with SNMP interface not working with Zabbix 5.0

SUMMARY

Zabbix 5.0 introduced a change in the host interface handling. The new documentation mentions a new details parameter which is used only for SNMP interfaces.

In order to create a new host with a SNMP interface this new property has to be set. Unfortunately the documentation seems to be not clear about which fields are mandatory and which are optional. There is ZBX-17719 handling this topic.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

zabbix_host

ANSIBLE VERSION
ansible 2.9.6
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /root/ansible/.venv/lib/python3.6/site-packages/ansible
  executable location = /root/ansible/.venv/bin/ansible
  python version = 3.6.8 (default, Aug  7 2019, 17:28:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE

I am trying to create zabbix hosts for our HPE iLOs. They are being monitored via SNMP.
For this procedure I am using the following task in an ansible playbook.

  zabbix_host:
    server_url: '{{ monitoring_server }}'
    login_user: '{{ monitoring_user }}'
    login_password: '{{ monitoring_password }}'
    host_name: '{{ ilo_ip }}'
    visible_name: '{{ dns_fqdn }}'
    host_groups: '{{ monitoring_groups | default(["iLO"]) }}'
    link_templates: '{{ monitoring_templates | default(["Template Server HP iLO SNMPv2"]) }}'
    interfaces:
    - type: 2
      main: 1
      useip: 1
      ip: '{{ ilo_ip }}'
      dns: ""
    status: '{{ monitoring_status | default("enabled") }}'
    state: '{{ monitoring_state | default("present") }}'
    validate_certs: no
EXPECTED RESULTS

The playbook should create the host. That has worked on Zabbix 4.4, while it is not working on Zabbix 5.0.

ACTUAL RESULTS

I get an error stating "Error -32602: Invalid params., Incorrect arguments passed to function."

fatal: [*** -> ***]: FAILED! => {"changed": false, "msg": "Failed to create host ***: ('Error -32602: Invalid params., Incorrect arguments passed to function. while sending {\"jsonrpc\": \"2.0\", \"method\": \"host.create\", \"params\": {\"host\": \"***\", \"interfaces\": [{\"type\": 1, \"main\": 1, \"useip\": 1, \"ip\": \"127.0.0.1\", \"dns\": \"\", \"port\": \"10050\"}, {\"type\": 2, \"main\": 1, \"useip\": 1, \"ip\": \"***\", \"dns\": \"\", \"port\": \"161\"}], \"groups\": [{\"groupid\": \"22\"}], \"status\": 0, \"tls_connect\": 1, \"tls_accept\": 1, \"name\": \"***\"}, \"auth\": \"***\", \"id\": 5}', -32602)"}

zabbix_action: media_type in operations does not choose the right one

SUMMARY

Hi,
i have created a new mediatype named BMC_Notification.
within my playbook i have created a new action named "Send alerts to BMC".
i have chosen the existing media_type BMC_Notification in this task, but when it was running i can see always that the mediatype "Email" was set.

i asume that the lines in the module

            return {
                'default_msg': '0' if operation.get('message') is not None or operation.get('subject')is not None else '1',
                'mediatypeid': self._zapi_wrapper.get_mediatype_by_mediatype_name(
                    operation.get('media_type')
                ) if operation.get('media_type') is not None else '0',
                'message': operation.get('message'),
                'subject': operation.get('subject'),
            }

returns a wrong id for the given media_type

In the Zabbix gui i can choose the right media_type in the ansible created action.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

zabbix_action
( https://github.com/ansible-collections/community.zabbix/blob/master/plugins/modules/zabbix_action.py )

ANSIBLE VERSION
ansible 2.9.4
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/admin/pweibbre/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Jun 20 2019, 13:30:36) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36.0.1)]
CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE

Create a media_type and run the task.

- name: deploy trigger action for BMC notification
  zabbix_action:
    login_user: Admin
    login_password: "{{ zabbix_admin_pw }}"
    server_url: "{{ zabbix_url }}"
    state: present
    event_source: 'trigger'
    status: enabled
    name: "Send alerts to BMC"
    esc_period: 1h
    conditions:
      - type: 'trigger_name'
        operator: 'like'
        value: 'WebCheck'
    operations:
      - type: send_message
        media_type: 'BMC_Notification'
        send_to_users:
          - 'zbx_robot'
    default_subject: 'Problem: {EVENT.NAME}'
    default_message: |
      Problem started at {EVENT.TIME} on {EVENT.DATE}
      Problem name: {EVENT.NAME}
      Host: {HOST.NAME}
      Severity: {EVENT.SEVERITY}

      Original problem ID: {EVENT.ID}
      {TRIGGER.URL}
    recovery_default_subject: 'Resolved: {EVENT.NAME}'
    recovery_default_message: |
      Problem has been resolved at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
      Problem name: {EVENT.NAME}
      Host: {HOST.NAME}
      Severity: {EVENT.SEVERITY}

      Original problem ID: {EVENT.ID}
      {TRIGGER.URL}
    recovery_operations:
      - type: send_message
        media_type: 'BMC_Notification'
        send_to_users:
          - 'zbx_robot'
    acknowledge_default_subject: 'Updated problem: {EVENT.NAME}'
    acknowledge_default_message: |
      {USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
      {EVENT.UPDATE.MESSAGE}

      Current problem status is {EVENT.STATUS}, acknowledged: {EVENT.ACK.STATUS}
    validate_certs: false
EXPECTED RESULTS

Playbook should set mediatype for this new action to the configured one ( BMC_Notification )

ACTUAL RESULTS

Playbook runs without errors, but the wrong mediatype is set in Zabbix.
Alwys set to Email instead of the configured one.

ok: [hostname] => {
    "changed": false,
    "invocation": {
        "module_args": {
            "acknowledge_default_message": "{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.\n{EVENT.UPDATE.MESSAGE}\n\nCurrent problem status is {EVENT.STATUS}, acknowledged: {EVENT.ACK.STATUS}\n",
            "acknowledge_default_subject": "Updated problem: {EVENT.NAME}",
            "acknowledge_operations": [],
            "conditions": [
                {
                    "formulaid": null,
                    "operator": "like",
                    "type": "trigger_name",
                    "value": "WebCheck",
                    "value2": null
                }
            ],
            "default_message": "Problem started at {EVENT.TIME} on {EVENT.DATE}\nProblem name: {EVENT.NAME}\nHost: {HOST.NAME}\nSeverity: {EVENT.SEVERITY}\n\nOriginal problem ID: {EVENT.ID}\n{TRIGGER.URL}\n",
            "default_subject": "Problem: {EVENT.NAME}",
            "esc_period": "1h",
            "eval_type": null,
            "event_source": "trigger",
            "formula": null,
            "http_login_password": null,
            "http_login_user": null,
            "login_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "login_user": "Admin",
            "name": "Send alerts to BMC",
            "operations": [
                {
                    "command": null,
                    "command_type": null,
                    "esc_period": null,
                    "esc_step_from": 1,
                    "esc_step_to": 1,
                    "execute_on": null,
                    "host_groups": null,
                    "inventory": null,
                    "media_type": "BMC_Notification",
                    "message": null,
                    "operation_condition": null,
                    "password": null,
                    "port": null,
                    "run_on_groups": null,
                    "run_on_hosts": null,
                    "script_name": null,
                    "send_to_groups": null,
                    "send_to_users": [
                        "zbx_robot"
                    ],
                    "ssh_auth_type": "password",
                    "ssh_privatekey_file": null,
                    "ssh_publickey_file": null,
                    "subject": null,
                    "templates": null,
                    "type": "send_message",
                    "username": null
                }
            ],
            "pause_in_maintenance": true,
            "recovery_default_message": "Problem has been resolved at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}\nProblem name: {EVENT.NAME}\nHost: {HOST.NAME}\nSeverity: {EVENT.SEVERITY}\n\nOriginal problem ID: {EVENT.ID}\n{TRIGGER.URL}\n",
            "recovery_default_subject": "Resolved: {EVENT.NAME}",
            "recovery_operations": [
                {
                    "command": null,
                    "command_type": null,
                    "execute_on": null,
                    "media_type": "BMC_Notification",
                    "message": null,
                    "password": null,
                    "port": null,
                    "run_on_groups": null,
                    "run_on_hosts": null,
                    "script_name": null,
                    "send_to_groups": null,
                    "send_to_users": [
                        "zbx_robot"
                    ],
                    "ssh_auth_type": "password",
                    "ssh_privatekey_file": null,
                    "ssh_publickey_file": null,
                    "subject": null,
                    "type": "send_message",
                    "username": null
                }
            ],
            "server_url": "https://zabbix-myownbox/zabbix/",
            "state": "present",
            "status": "enabled",
            "timeout": 10,
            "validate_certs": false
        }
    },
    "msg": "Action is up to date: Send alerts to BMC"
}

Zabbix Agent: Supporting entries commented on zabbix_agentd.conf

Hello,
I think it would be useful to have some parameters config on /etc/zabbix/zabbix_agentd.d/

Maybe we can add a magic value, so:

agent_timeout: onfile 3 # create /etc/zabbix/zabbix_agentd.d/timeout.conf and comment it on zabbix_agentd.conf
agent_timeout: commented # comment Timeout directive on zabbix_agentd.conf

What do you think ?

Would you accept a patch for this ? Or you don't see it a good idea?

Thank you very much

Coming from: dj-wasabi/ansible-zabbix-agent#50

cc: @i5513

about the integration test method

PURPOSE

Here we discuss the integration test method for the Zabbix module.
It provisioning for test environment uses docker-compose? or ansible-test integration command? (and so on)

Zabbix Agent: No package matching 'zabbix-agent

Describe the bug
While running the script, I get an error
fatal: [*****************]: FAILED! => {"changed": false, "msg": "No package matching 'zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get' is available"}

Installation method/version
ansible 2.7.5
config file = /home/user/ansible-zabbix-agent/ansible.cfg
configured module search path = [u'/home/user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0]

Github using master

hosts -
Ubuntu
Debian
CentOS

Additional context

playbook 
- hosts: tabak-ht
  become: true
# become_method: sudo
  roles:
   - role: dj-wasabi.zabbix-agent
     zabbix_agent_server: 10.0.0.220
     zabbix_agent_serveractive: 10.0.0.220
     zabbix_agent_package: zabbix-agent
     zabbix_version: 4.0

playbook works well up to a TASK [dj-wasabi.zabbix-agent : Debian | Installing zabbix-agent]

TASK [dj-wasabi.zabbix-agent : Debian | Installing zabbix-agent] *************************************************************************
fatal: [**********]: FAILED! => {"changed": false, "msg": "No package matching 'zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get' is available"}
fatal: [**********]: FAILED! => {"changed": false, "msg": "No package matching 'zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get' is available"}
fatal: [**********]: FAILED! => {"changed": false, "msg": "No package matching 'zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get' is available"}
fatal: [**********]: FAILED! => {"changed": false, "msg": "No package matching 'zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get' is available"}
fatal: [**********]: FAILED! => {"changed": false, "msg": "No package matching 'zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get' is available"}
fatal: [**********]: FAILED! => {"changed": false, "msg": "No package matching 'zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get' is available"}

On Centos i have same problem

if I go to a managed host and see the availability of the packages -

root@**********:~# apt-cache show zabbix-agent
Package: zabbix-agent
Source: zabbix
Version: 1:4.0.3-1+stretch

At the same time using the command
ansible -m command -a "apt-get install zabbix-agent -y" hosts
Agent setup ok

Log exsample
user@*******###########:~/ansible-zabbix-agent$ sudo ansible-playbook tabak-ht-playbook.yml --diff

>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name:  *******
> 
>  [WARNING]: Found both group and host with same name:  *******
> 
>  [WARNING]: Found both group and host with same name:*******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
> 
> PLAY [tabak-ht] **************************************************************************************************************************
> 
> TASK [Gathering Facts] *******************************************************************************************************************
> ok: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Fix facts for linuxmint - distribution release] ***********************************************************
> skipping: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Fix facts for linuxmint - family] *************************************************************************
> skipping: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Include OS-specific variables] ****************************************************************************
> ok: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : RedHat | Use EPEL package name] ***************************************************************************
> skipping: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : RedHat | Install basic repo file] *************************************************************************
> skipping: [*******] => (item={u'state': u'present', u'description': u'Zabbix Official Repository - $basearch', u'gpgcheck': 0, u'gpgkey': u'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX', u'baseurl': u'http://repo.zabbix.com/zabbix/4.0/rhel/9/$basearch/', u'name': u'zabbix'})
> skipping: [*******] => (item={u'state': u'present', u'description': u'Zabbix Official Repository non-supported - $basearch', u'gpgcheck': 0, u'gpgkey': u'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX', u'baseurl': u'http://repo.zabbix.com/non-supported/rhel/9/$basearch/', u'name': u'zabbix-non-supported'})
> 
> TASK [dj-wasabi.zabbix-agent : Do a yum clean] *******************************************************************************************
> skipping: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : RedHat | Installing zabbix-agent] *************************************************************************
> skipping: [*******] => (item=zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get)
> 
> TASK [dj-wasabi.zabbix-agent : RedHat | Installing zabbix-agent] *************************************************************************
> skipping: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Install policycoreutils-python] ***************************************************************************
> skipping: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : RedHat | Enable the service] ******************************************************************************
> skipping: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Include Zabbix gpg ids] ***********************************************************************************
> ok: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Set short version name] ***********************************************************************************
> ok: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Debian | Install gpg key] *********************************************************************************
> ok: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Debian | Installing deb-src repository Ubuntu] ************************************************************
> skipping: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Debian | Installing deb repository Debian] ****************************************************************
> ok: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Debian | Installing deb-src repository Debian] ************************************************************
> ok: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Debian | Installing deb repository Ubuntu] ****************************************************************
> skipping: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Debian | Installing zabbix-agent] *************************************************************************
> fatal: [*******]: FAILED! => {"changed": false, "msg": "No package matching 'zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get' is available"}
>         to retry, use: --limit @/home/user/ansible-zabbix-agent/tabak-ht-playbook.retry
> 
> PLAY RECAP *******************************************************************************************************************************
> *******      : ok=7    changed=0    unreachable=0  

Coming from: : dj-wasabi/ansible-zabbix-agent#197
cc: @Blufaer @asurinsaka @alexdjachenko

Zabbix Roles?

SUMMARY

Is it possible to work with dj-wasabi and get the zabbix roles also included in this?

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

zabbix.agent
zabbix.server
zabbix.web

ADDITIONAL INFORMATION

Redundant files identification, roles documentation and changelogs

SUMMARY

Identify all files in Zabbix roles that no longer fit in or their placement is not optimal after merge. Decide on their future. This is more of a discussion issue.

Dependent on the completion of #20 .

There will be more of them, but a few ideas straight away :

  • roles/*/README.md -> centralize somewhere like docs/? How other collections handle this?
  • roles/*/CHANGELOG.md -> centralize in ~/CHANGELOG.md?
  • roles/*/[_A-Z]+.*
  • roles/*/.github/*
  • roles/*/.travis.yml -> rework to Github Actions
  • roles/*/.yamllint -> lets start to use this for the whole repo I would say
ISSUE TYPE
  • Feature Idea

Error -32500: Application error., Cannot update "groups" for a discovered host

SUMMARY

When disabling a Zabbix host, the task fails if the host has been created by a discovery (host.flags=4).

The same issue occours for properties: tls_connect, tls_accept, groups, proxy_hostid.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

# get the group_ids from the existing host without updating them.

ANSIBLE VERSION
ansible 2.9.6
  config file = ansible/ansible.cfg
  configured module search path = ['.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = ansible/venv/lib64/python3.6/site-packages/ansible
  executable location = ansible/venv/bin/ansible
  python version = 3.6.8 (default, Aug  7 2019, 17:28:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

CONFIGURATION
DEFAULT_CALLBACK_WHITELIST(ansible/ansible.cfg) = ['profile_tasks', 'timer']
HOST_KEY_CHECKING(ansible/ansible.cfg) = False
INVENTORY_ENABLED(ansible/ansible.cfg) = ['script', 'host_list', 'yaml', 'ini', 'vmware_vm_inventory']
USE_PERSISTENT_CONNECTIONS(ansible/ansible.cfg) = True
OS / ENVIRONMENT
  • Linux *** 3.10.0-957.10.1.el7.x86_64 #1 SMP Mon Mar 18 15:06:45 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • CentOS Linux release 7.6.1810 (Core)
STEPS TO REPRODUCE
  1. Use the zabbix_host_info to find some hosts.
  2. Loop to disable them, leaving a note in the Description field.
    - name: enable host in Zabbix Server
      when:
        - item.status == '1'
      environment:
        no_proxy: "127.0.0.1,localhost,.local,{{zabbix_server_host}}"
      local_action:
        module: zabbix_host
        server_url: "{{zabbix_api_url}}"
        validate_certs: no
        login_user: "{{zabbix_api_user}}"
        login_password: "{{zabbix_api_pass}}"
        host_name: "{{item.host}}"
        status: enabled
        description: "{{ item.description + '\n\n' if item.description else '' }}Enabled on {{ lookup('env','CURRENT_TIMESTAMP') }}{{ ' by ' + lookup('env','GITLAB_USER_NAME') + ', using Ansible through Gitlab (job ID: ' + lookup('env','CI_JOB_ID') + ').' if lookup('env','GITLAB_USER_NAME') else '' }}"
      retries: 2
      delay: 2
      throttle: 1
      register: result
      until: result is not failed
      loop: "{{ zabbix_host_infos.hosts }}"
EXPECTED RESULTS

The module should change only the requested property, in this case "status" and "description", not all of them. Or maybe use flags to discern which properties are read-only.

ACTUAL RESULTS

Error message:

  • Failed to update host omissis: ('Error -32500: Application error., Cannot update "groups" for a discovered host "omissis". while sending {"jsonrpc": "2.0", "method": "host.update", "params": {"hostid": "25149", "groups": [{"groupid": "636"}], "status": 0, "tls_connect": 1, "tls_accept": 1, "proxy_hostid": 18862, "description": "Enabled on Tue Jun 16 18:01:56 CEST 2020"}, "auth": "2ab80fd1bccd459decb84e74049dd5d4", "id": 9}', -32500)

Module zabbix_action does not contain "Notify all involved"

From @lokly on 4 Jul 2019

SUMMARY

The module zabbix_action does not contain the Zabbix operation "Notify all involved", that can be selected in the section "Recovery operations" and "Update operations".

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

lib/ansible/modules/monitoring/zabbix/zabbix_action.py

ANSIBLE VERSION

2.8.1

Copied from original issue: ansible/ansible#58719

Zabbix Proxy: MySQL schema creation failure

Describe the bug
MySQL schema import fails when database server is installed on dedicated host other then proxy itself. The reason seems to be lack of schema file on database host linked with delegation of schema import task to database host.

Installation method/version
1.6.0 installed by ansible-galaxy over git+ssh

Ansible Version

ansible 2.8.5

Targetted hosts
Concerns the following OS(es):

  • Ubuntu

Expected behavior

Schema creation should be executed on zabbix-proxy host by mysql_db module against remote MySQL server over MySQL protocol.

OR

There should be additional step of shipping schema file when schema creation is delegated to MySQL host.

copy from: dj-wasabi/ansible-zabbix-proxy#60
cc: @dcdamien

Integration test error occur of zabbix_proxy with zabbix 5.0

SUMMARY

The integration test result for zabbix_proxy, changed occurs when performing the same task that has not been parameters changed.
It is necessary review the configuration comparison process.

(venv) [root@zbxcont zabbix]# ansible-test integration zabbix_proxy
(snip)
TASK [zabbix_proxy : test - create new passive Zabbix proxy server] ************************************************************************************************
[WARNING]: The value 10051 (type int) in a string field was converted to '10051' (type string). If this does not look like what you expect, quote the entire value
to ensure it does not change.
changed: [testhost]

TASK [zabbix_proxy : assert that proxy was created] ****************************************************************************************************************
ok: [testhost] => {
    "changed": false,
    "msg": "All assertions passed"
}

TASK [zabbix_proxy : test - create same passive Zabbix proxy server] ***********************************************************************************************
changed: [testhost]

TASK [zabbix_proxy : assert that nothing has been changed] *********************************************************************************************************
fatal: [testhost]: FAILED! => {
    "assertion": "not zbxproxy_existing is changed",
    "changed": false,
    "evaluated_to": false,
    "msg": "Assertion failed"
}

PLAY RECAP *********************************************************************************************************************************************************
testhost                   : ok=7    changed=2    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
ISSUE TYPE
  • Bug Report
COMPONENT NAME

zabbix_proxy

ANSIBLE VERSION
(venv) [root@zbxcont zabbix]# ansible --version
ansible 2.10.0.dev0
OS / ENVIRONMENT
  • zabbix 5.0
ADDITIONAL INFORMATION

Playbook failing.. getting KeyError inventory_mode

From @dj-wasabi on 6 Mar 2020

SUMMARY

I have created a simple playbook that points to the role dj-wasabi.zabbix-agent, which is installed by AWX on the flight.
The playbook has worked earlier (two days ago) and not it doesn't work anymore.

I receive following issue, when running the playbook on my ansible server (towards every host).

ISSUE TYPE
  • Bug Report
COMPONENT NAME

zabbix_host

ANSIBLE VERSION
ansible 2.9.5
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/tobias/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Nov 21 2019, 19:31:34) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]
CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE
bash-4.4# cat roles/requirements.yml
---
- src: https://github.com/dj-wasabi/ansible-zabbix-agent
  version: master
  name: dj-wasabi.zabbix-agent

Having the following ansible vars set:

zabbix_agent_firewalld_enable: true
zabbix_agent_server: 10.0.1.XXX
zabbix_agent_serveractive: 10.0.1.XXX
zabbix_api_create_hosts: true
zabbix_api_create_hostgroup: true
zabbix_api_use: true
zabbix_api_user: YYY
zabbix_api_pass: ZZZ
zabbix_useuip: 1
zabbix_host_groups:
  - "Linux servers"
zabbix_link_templates:
  - "Template OS Linux by Zabbix agent"
zabbix_url: 'http://10.0.1.XXX'
zabbix_selinux: true

Following is part of the playbook.yml

- hosts: all
  roles:
      - role: dj-wasabi.zabbix-agent
EXPECTED RESULTS

Succesful host creation in the Zabbix Web interface.

ACTUAL RESULTS
The full traceback is:
Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-tmp-1583395986.5052142-98721871607287/AnsiballZ_zabbix_host.py", line 114, in <module>
    _ansiballz_main()
  File "/root/.ansible/tmp/ansible-tmp-1583395986.5052142-98721871607287/AnsiballZ_zabbix_host.py", line 106, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/root/.ansible/tmp/ansible-tmp-1583395986.5052142-98721871607287/AnsiballZ_zabbix_host.py", line 49, in invoke_module
    imp.load_module('__main__', mod, module, MOD_DESC)
  File "/usr/lib64/python3.6/imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "/usr/lib64/python3.6/imp.py", line 170, in load_source
    module = _exec(spec, sys.modules[name])
  File "<frozen importlib._bootstrap>", line 618, in _exec
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/tmp/ansible_zabbix_host_payload_bm7p5trw/__main__.py", line 857, in <module>
  File "/tmp/ansible_zabbix_host_payload_bm7p5trw/__main__.py", line 817, in main
  File "/tmp/ansible_zabbix_host_payload_bm7p5trw/__main__.py", line 502, in check_all_properties
KeyError: 'inventory_mode'
fatal: [psg1-lobbymirror-001.home -> localhost]: FAILED! => {
    "attempts": 3,
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1583395986.5052142-98721871607287/AnsiballZ_zabbix_host.py\", line 114, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1583395986.5052142-98721871607287/AnsiballZ_zabbix_host.py\", line 106, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1583395986.5052142-98721871607287/AnsiballZ_zabbix_host.py\", line 49, in invoke_module\n    imp.load_module('__main__', mod, module, MOD_DESC)\n  File \"/usr/lib64/python3.6/imp.py\", line 235, in load_module\n    return load_source(name, filename, file)\n  File \"/usr/lib64/python3.6/imp.py\", line 170, in load_source\n    module = _exec(spec, sys.modules[name])\n  File \"<frozen importlib._bootstrap>\", line 618, in _exec\n  File \"<frozen importlib._bootstrap_external>\", line 678, in exec_module\n  File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\n  File \"/tmp/ansible_zabbix_host_payload_bm7p5trw/__main__.py\", line 857, in <module>\n  File \"/tmp/ansible_zabbix_host_payload_bm7p5trw/__main__.py\", line 817, in main\n  File \"/tmp/ansible_zabbix_host_payload_bm7p5trw/__main__.py\", line 502, in check_all_properties\nKeyError: 'inventory_mode'\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

Link: dj-wasabi/ansible-zabbix-agent#308

Copied from original issue ansible/ansible#68088

Zabbix 5.0 support

SUMMARY

Zabbix 5.0.0 has been released: https://www.zabbix.com/release_notes

The README.md file states:

As a main priority, this collection aims to cover all of the currently supported Zabbix releases, which are noted on the Zabbix Life Cycle & Release Policy page.

I'm curious if there has been some progress made towards supporting Zabbix 5.0 or if there is some scheduling in place.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

Supported Zabbix Versions

ADDITIONAL INFORMATION

I know that version 5.0.0 has just been released. From what I extracted from the release notes there are no breaking changes. The client is aimed to be a drop-in-replacement where config compatibility is preserved. An upgrade of the server is supported, too: https://www.zabbix.com/documentation/current/manual/installation/upgrade

Add new maintainer

SUMMARY

@dj-wasabi can join our ranks as repo maintainer if he agrees (at least thumbs up required) :)

Dependent on the completion of #20.

ISSUE TYPE
  • Feature Idea

Error in zabbix_action

SUMMARY

Error on zabbix_action if there's no change.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

zabbix_action

ANSIBLE VERSION
ansible 2.9.9
  config file = /d/Code/gitlab/zabbix-servers/ansible/ansible.cfg
  configured module search path = ['/home/fism/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /d/Code/gitlab/zabbix-servers/venv/lib/python3.8/site-packages/ansible
  executable location = /d/Code/gitlab/zabbix-servers/venv/bin/ansible
  python version = 3.8.2 (default, Apr 27 2020, 15:53:34) [GCC 9.3.0]

community.zabbix==0.2.0
ENVIRONMENT

Zabbix 5.0.1 (centos containers)

STEPS TO REPRODUCE

Running the play the first time creates the action. Subsequent runs are failing.

- name: "Defining default proxy actions"
      delegate_to: localhost
      zabbix_action:
        server_url: "{{ zabbix_apiserver_url }}"
        login_user: "{{ zabbix_apiuser_rw }}"
        login_password: "{{ zabbix_apipassword_rw }}"
        event_source: auto_registration
        name: "{{ zabbix_action_name }}"
        status: enabled
        esc_period: 1h
        state: present
        formula: A
        conditions:
          - type: 'proxy'
            operator: '='
            value: "proxya"
            formulaid: A
        operations:
          - type: 'add_to_host_group'
            host_groups: "INTRA"
EXPECTED RESULTS

Subsequent runs shouldn't fail.

ACTUAL RESULTS
The full traceback is:
  File "/tmp/ansible_zabbix_action_payload_mujf4st6/ansible_zabbix_action_payload.zip/ansible/modules/zabbix_action.py", line 882, in update_action
  File "/d/Code/gitlab/zabbix-servers/venv/lib/python3.8/site-packages/zabbix_api.py", line 341, in method
    return self.universal("%s.%s" % (self.data["prefix"], name), opts[0])
  File "/d/Code/gitlab/zabbix-servers/venv/lib/python3.8/site-packages/zabbix_api.py", line 79, in wrapper
    return self.do_request(self.json_obj(method, opts))['result']
  File "/d/Code/gitlab/zabbix-servers/venv/lib/python3.8/site-packages/zabbix_api.py", line 348, in do_request
    return self.parent.do_request(req)
  File "/d/Code/gitlab/zabbix-servers/venv/lib/python3.8/site-packages/zabbix_api.py", line 299, in do_request
    raise ZabbixAPIException(msg, jobj['error']['code'])
fatal: [zabbixintra01p -> localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "acknowledge_default_message": "",
            "acknowledge_default_subject": "",
            "acknowledge_operations": [],
            "conditions": [
                {
                    "formulaid": "A",
                    "operator": "=",
                    "type": "proxy",
                    "value": "xxx",
                    "value2": null
                }
            ],
            "default_message": "",
            "default_subject": "",
            "esc_period": "1h",
            "eval_type": null,
            "event_source": "auto_registration",
            "formula": "A",
            "http_login_password": null,
            "http_login_user": null,
            "login_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "login_user": "xxx",
            "name": "AUTO - add Proxy Group - intra",
            "operations": [
                {
                    "command": null,
                    "command_type": null,
                    "esc_period": null,
                    "esc_step_from": 1,
                    "esc_step_to": 1,
                    "execute_on": null,
                    "host_groups": [
                        "INTRA"
                    ],
                    "inventory": null,
                    "media_type": null,
                    "message": null,
                    "operation_condition": null,
                    "password": null,
                    "port": null,
                    "run_on_groups": null,
                    "run_on_hosts": null,
                    "script_name": null,
                    "send_to_groups": null,
                    "send_to_users": null,
                    "ssh_auth_type": "password",
                    "ssh_privatekey_file": null,
                    "ssh_publickey_file": null,
                    "subject": null,
                    "templates": null,
                    "type": "add_to_host_group",
                    "username": null
                }
            ],
            "pause_in_maintenance": true,
            "recovery_default_message": "",
            "recovery_default_subject": "",
            "recovery_operations": [],
            "server_url": "http://xxx/",
            "state": "present",
            "status": "enabled",
            "timeout": 10,
            "validate_certs": true
        }
    },
    "msg": "Failed to update action '28': ('Error -32500: Application error., Cannot perform update statement on table \"actions\" without values. while sending {\"jsonrpc\": \"2.0\", \"method\": \"action.update\", \"params\": {\"def_longdata\": \"\", \"def_shortdata\": \"\", \"r_longdata\": \"\", \"r_shortdata\": \"\", \"ack_longdata\": \"\", \"ack_shortdata\": \"\", \"actionid\": \"28\"}, \"auth\": \"xxx\", \"id\": 6}', -32500)"
}

Rework CI for merged roles

SUMMARY

Current candidate - Github Actions from previous Travis CI. Example of working CI with Actions:
https://github.com/ericsysmin/ansible-collection-system/tree/master/.github/workflows

More information in:

Dependent on the completion of #20.

We should look at how the whole CI operates after this is solved. There is probably no need to run tests for plugins when a change to role occurs.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

.github/workflows/roles.yml

zabbix_template creates template in check mode

SUMMARY

The module zabbix_template creates a new template when in check mode with zabbix 4.0.
I use template_json to import a new template with just the enough data to create it.
The normal mode (not in check mode) works as expected: Shows "changed" when the template doesn't exist, and just "ok" when it already exists.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

zabbix_template

ANSIBLE VERSION
ansible 2.9.9
  config file = /home/chestrada/ansible/vfmsa_ansible/ansible.cfg
  configured module search path = ['/home/chestrada/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/chestrada/xxx/ansible/lib/python3.6/site-packages/ansible
  executable location = /home/chestrada/xxx/ansible/bin/ansible
  python version = 3.6.9 (default, Apr 18 2020, 01:56:04) [GCC 8.4.0]

CONFIGURATION
ANSIBLE_PIPELINING(/home/chestrada/ansible/vfmsa_ansible/ansible.cfg) = True
ANSIBLE_SSH_ARGS(/home/chestrada/ansible/vfmsa_ansible/ansible.cfg) = -o ControlMaster=auto -o ControlPersist=1800s -o PreferredAuthentications=publickey
CACHE_PLUGIN(/home/chestrada/ansible/vfmsa_ansible/ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(/home/chestrada/ansible/vfmsa_ansible/ansible.cfg) = ~/ansible_cache
CACHE_PLUGIN_TIMEOUT(/home/chestrada/ansible/vfmsa_ansible/ansible.cfg) = 86400
DEFAULT_CALLBACK_PLUGIN_PATH(/home/chestrada/ansible/vfmsa_ansible/ansible.cfg) = ['/home/chestrada/py_ansible/lib/python3.6/site-packages/ara/plugins/callba
DEFAULT_FORKS(/home/chestrada/ansible/vfmsa_ansible/ansible.cfg) = 50
DEFAULT_GATHERING(/home/chestrada/ansible/vfmsa_ansible/ansible.cfg) = smart
DEFAULT_INTERNAL_POLL_INTERVAL(/home/chestrada/ansible/vfmsa_ansible/ansible.cfg) = 0.001
DEFAULT_ROLES_PATH(/home/chestrada/ansible/vfmsa_ansible/ansible.cfg) = ['/home/chestrada/ansible/vfmsa_roles']
DEFAULT_STDOUT_CALLBACK(/home/chestrada/ansible/vfmsa_ansible/ansible.cfg) = yaml
DEFAULT_VAULT_PASSWORD_FILE(/home/chestrada/ansible/vfmsa_ansible/ansible.cfg) = /home/chestrada/.ansible_vault
RETRY_FILES_SAVE_PATH(/home/chestrada/ansible/vfmsa_ansible/ansible.cfg) = /home/chestrada/.ansible-retry

OS / ENVIRONMENT

Ubuntu 18.04
Zabbix 4.0

STEPS TO REPRODUCE

Run the playbook in check mode when the template still doesn't exist:

ansible-playbook -i inventory.yml test_playbook.yml -l srvd-test06 --check

PLAY [all] **************************************************************************************************************************************************

TASK [include_vars - Load vars form file] *******************************************************************************************************************
ok: [srvd-test06]

TASK [Import template] **************************************************************************************************************************************
changed: [srvd-test06 -> localhost]

PLAY RECAP **************************************************************************************************************************************************
srvd-test06                : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0 


test_playbook.yml:

---
- hosts: all
  tasks:

  - name: "include_vars - Load vars form file"
    include_vars: {file: testing_vars.yml, name: varsfromfile}

  - name: "Import template"
    zabbix_template:
      state: present
      validate_certs: false
      server_url: "https://{{ ansible_host }}"
      login_user: Admin
      login_password: "{{ zabbix_admin_pass | default('zabbix') }}"
      template_json: "{{ varsfromfile }}"
    delegate_to: localhost
...

testing_vars.yml:

---
zabbix_export:
  version: '4.0'
  templates:
    - name: templates_name_test1
      template: templates_template_test1
      description: templates_description_test1
      groups:
        - name: Templates
...
EXPECTED RESULTS

Ansible should only check for the template and report if there is going to be change. But not make changes.

ACTUAL RESULTS

Ansible creates the template, which can be confirmed in the Zabbix GUI.


zabbix_screen: documentation issues

From @richlv on 15 Apr 2019

SUMMARY

See https://docs.ansible.com/ansible/latest/modules/zabbix_screen_module.html .

There seem to be a few issues here that would need help from somebody familiar with this module, otherwise I'd have submitted a pull request.
Some of these might turn out to be bugs in the module itself, too (like the host_group issue below).

  • The tagline is "This module allows you to create, modify and delete Zabbix screens and associated graph data.". It is not clear what associated graph data is meant here, surely this module does not modify any Zabbix custom graphs?
  • Screen properties are largely undocumented, except for appearing in the examples.
  • The documentation says "When creating or updating screen(s), screen_name, host_group are required.". Zabbix screens are not tied to hostgroups, why is hostgroup required here (and supported in the first place)? Reading through the examples again and again, is this perhaps related to only graphs being supported, and thus group name where the graphs will be looked up from? If so, what will happen when there will be multiple graphs with the same name in the group?
  • All the parameters and the scant documentation talk about graphs - are graphs the only screen element type that is supported?
  • There's some special undocumented logic, as indicated by the code comment "when there're only one host, only one row is not good".
ISSUE TYPE
  • Bug Report
COMPONENT NAME

zabbix_screen

ANSIBLE VERSION

latest

CONFIGURATION

Not relevant.

OS / ENVIRONMENT

Not relevant.

Copied from original issue: ansible/ansible#55345

allow specifying interface for templates in zabbix_host

From @richlv on 26 Jul 2019

SUMMARY

When linking templates in Zabbix, items get attached to the "main" interface, if there are multiple interfaces of same type.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

zabbix_host

ADDITIONAL INFORMATION

If there are multiple interfaces - let's say JMX - there is no way to specify to which interface should each template go. This makes it impossible to monitor multiple applications when using zabbix_host.

It would be great to specify the interface to which items from a specific template should go. Technically, this would likely happen by setting the main interface before linking that template, or by explicitly setting interface for all affected items.

Copied from original issue: ansible/ansible#59624

Zabbix Agent: Role is setting first public IP as agent IP when private IPs are available

Describe the bug
As the title says, the role is setting first public IP as agent IP when private IPs are available. If I look at main.yml, it should only select a public IP when there is no private IP available. It's worth noting that the public and the private IPs are on different interfaces.

Installation method/version

  • Ansible Galaxy, role version: 1.7.1

Ansible Version

ansible 2.8.1
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.13 (default, Sep 26 2018, 18:42:22) [GCC 6.3.0 20170516]

Targetted hosts

  • Debian 7.11

Expected behavior
The role selects the available private IP instead of the public IP for the Zabbix agent IP.

Additional context
Target Zabbix agent version is 3.4.

Coming from: dj-wasabi/ansible-zabbix-agent#234
cc: @kobuki

Document roles in main README.md and galaxy.yml files

SUMMARY

Update repo's main README.md and galaxy.yml files to include new roles and information about them.

Do this before merging devel-roles-migration to master branch.

Dependent on the completion of:

ISSUE TYPE
  • Documentation Report
COMPONENT NAME

README.md
galaxy.yml

Branching design

SUMMARY

Agree upon and document a branching design (or what is the official name for it) for this repository.

Right now, we are silently using something like 'Every PR against master branch. After some time, tag latest commit as some version, which should be automatically then published on galaxy. Rinse and repeat.'

Do we want to introduce something more complex? Development branch, feature branches, hotfix branches, etc.. this for example - https://nvie.com/posts/a-successful-git-branching-model/.

Does our "workload" and contribution frequency justify more complex model? Will it make more sense in the future should the community grow?

ISSUE TYPE
  • Documentation Report

Release

Hi,
I've hopefully made the correct updates to Zuul CI so Zuul will monitor for git tag and do the magic of build and publish a collection release to Galaxy.

Feel free to test this at your convenience, I believe you wanted to update the changelogs first?

Please shout out once you have, or if there are any problems.

Warning after a failed zabbix_action task: "TypeError: 'ZabbixAPISubClass' object is not callable"

From @richlv on 18 Sep 2019

SUMMARY

Warning after a failed zabbix_action task: "TypeError: 'ZabbixAPISubClass' object is not callable"

[WARNING]: Module invocation had junk after the JSON data: Error in atexit._run_exitfuncs: Traceback (most recent call last): File "/usr/lib64/python2.7/atexit.py", line 24, in _run_exitfuncs func(*targs, **kargs) TypeError: 'ZabbixAPISubClass' object is not callable Error in sys.exitfunc: Traceback (most recent call last): File "/usr/lib64/python2.7/atexit.py", line 24, in _run_exitfuncs func(*targs, **kargs) TypeError: 'ZabbixAPISubClass' object is not callable

ISSUE TYPE
  • Bug Report
COMPONENT NAME

zabbix_action

ANSIBLE VERSION
ansible 2.8.5
  config file = /opt/ansible/config/ansible-config.cfg
  configured module search path = [u'/home/user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/venv-ansible/lib/python2.7/site-packages/ansible
  executable location = /opt/venv-ansible/bin/ansible
  python version = 2.7.16 (default, May 20 2019, 06:24:37) [GCC 4.4.7 20120313 (Red Hat 4.4.7-23)]
CONFIGURATION
DEFAULT_FORKS(/opt/ansible/config/ansible-config.cfg) = 100
DEFAULT_HOST_LIST(/opt/ansible/config/ansible-config.cfg) = [u'/opt/ansible/inventory/cert/hosts']
HOST_KEY_CHECKING(/opt/ansible/config/ansible-config.cfg) = False
RETRY_FILES_ENABLED(/opt/ansible/config/ansible-config.cfg) = False
OS / ENVIRONMENT

RHEL6 master, RHEL7 target

STEPS TO REPRODUCE

Running a task that fails.

EXPECTED RESULTS

No warning/error.

ACTUAL RESULTS

Warning/error.

Copied from original issue: ansible/ansible#62485

zabbix_action: condition value considered required when it should not be

From @richlv on 10 Jan

SUMMARY

According to the Zabbix manual, the condition type "Problem is suppressed" has: "No value required".

ISSUE TYPE
  • Bug Report
COMPONENT NAME

zabbix_action

ANSIBLE VERSION

latest

STEPS TO REPRODUCE

"Problem is suppressed" matches maintenance_status in zabbix_action (value 16).

Try an action with a condition like so:

      - type: 'maintenance_status'
        operator: 'No'
EXPECTED RESULTS

Action created.

ACTUAL RESULTS

Fails with:

missing required arguments: value found in conditions

Copied from original issue: ansible/ansible#66343

Regarding CHANGELOG

SUMMARY

Its apparent that at some point we will be releasing next version of this collection. In the meantime, changes are accumulating.

Should we require that with each change to a module or roles, an entry will be added to the CHANGELOG.md under "devel" section or something like that?

ISSUE TYPE
  • Documentation Report

Error when specifying macors in zabbix_template module

SUMMARY

If macros are not defined in the target template, specifying macors in the zabbix_template module causes an error of KeyError: 'macros'.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

zabbix_template

ANSIBLE VERSION
ansible 2.9.2
  config file = None
  configured module search path = ['/home/mitsuru/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/mitsuru/hive/lib64/python3.6/site-packages/ansible
  executable location = /home/mitsuru/hive/bin/ansible
  python version = 3.6.8 (default, Aug  7 2019, 17:28:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
OS / ENVIRONMENT

target OS: CentOS Linux release 7.6.1810 (Core)
target Zabbix: 5.0
python: 3.6.8

STEPS TO REPRODUCE

zabbix server was started with the following docker-compose.yml.

version: "3.4"
services:
  zabbix-server:
    image: zabbix/zabbix-server-mysql:ubuntu-trunk
    container_name: zabbix-server
    environment:
      TZ: "Asia/Tokyo"
      DB_SERVER_HOST: mariadb
      MYSQL_ROOT_PASSWORD: "wgEPXNQGLF7zT63"
      MYSQL_USER: zabbix
      MYSQL_PASSWORD: zabbix
      MYSQL_DATABASE: zabbix
    ports:
      - "10051:10051"
    restart: unless-stopped
    networks:
      default:
        ipv4_address: "172.21.35.130"
  zabbix-web:
    image: zabbix/zabbix-web-nginx-mysql:ubuntu-trunk
    container_name: zabbix-web
    environment:
      TZ: "Asia/Tokyo"
      DB_SERVER_HOST: mariadb
      MYSQL_ROOT_PASSWORD: "wgEPXNQGLF7zT63"
      MYSQL_USER: zabbix
      MYSQL_PASSWORD: zabbix
      MYSQL_DATABASE: zabbix
    ports:
      - "10052:80"
    restart: unless-stopped
    networks:
      default:
        ipv4_address: "172.21.35.131"
  mariadb:
    image: mariadb:10.4
    container_name: mariadb
    environment:
      TZ: "Asia/Tokyo"
      MYSQL_ROOT_PASSWORD: "wgEPXNQGLF7zT63"
      MYSQL_USER: zabbix
      MYSQL_PASSWORD: zabbix
      MYSQL_DATABASE: zabbix
      # maridb container spend long time to initialize timezone info of the database.
      # it can be skip by following envinronment variable.
      # MYSQL_INITDB_SKIP_TZINFO: "yes"
    volumes:
      - data:/var/lib/mysql
      - config:/etc/mysql/
    hostname: mariadb
    ##  Don't use charset utf8mb4, it cause folloing error for varchar(1024) key field in items table
    ## ** Creating 'zabbix' schema in MySQL
    ## ERROR 1071 (42000) at line 356: Specified key was too long; max key length is 3072 bytes
    command:
    - "--character-set-server=utf8mb3"
    - "--collation-server=utf8mb3_unicode_ci"
    expose:
      - "3306"
    restart: unless-stopped
    networks:
      default:
        ipv4_address: "172.21.35.132"

Performed the following task

- name: Configure macros on the Template OS Linux by Zabbix agent
  zabbix_template:
    server_url: http://{{ inventory_hostname }}:10052
    login_user: admin
    login_password: zabbix
    template_name: Template OS Linux by Zabbix agent
    macros:
      - macro: '{$VFS.FS.FSNAME.NOT_MATCHES}'
        value: ^(/dev|/sys|/run|/proc|.+/shm$|/var/lib/docker)
    state: present
EXPECTED RESULTS

The task is successfully executed and the macro is added to the template

ACTUAL RESULTS

cause error

TASK [zabbix : Configure macros on the Template OS Linux by Zabbix agent] *************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: KeyError: 'macros'
fatal: [s-hive2.funos]: FAILED! => {
    "changed": false,
    "rc": 1
}

MSG:

MODULE FAILURE
See stdout/stderr for the exact error


MODULE_STDOUT:

Traceback (most recent call last):
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1588117733.0906963-210872852800312/AnsiballZ_zabbix_template.py", line 102, in <module>
    _ansiballz_main()
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1588117733.0906963-210872852800312/AnsiballZ_zabbix_template.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1588117733.0906963-210872852800312/AnsiballZ_zabbix_template.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible.modules.monitoring.zabbix.zabbix_template', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/lib64/python3.6/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_zabbix_template_payload_b02ikva_/ansible_zabbix_template_payload.zip/ansible/modules/monitoring/zabbix/zabbix_template.py", line 743, in <module>
  File "/tmp/ansible_zabbix_template_payload_b02ikva_/ansible_zabbix_template_payload.zip/ansible/modules/monitoring/zabbix/zabbix_template.py", line 727, in main
  File "/tmp/ansible_zabbix_template_payload_b02ikva_/ansible_zabbix_template_payload.zip/ansible/modules/monitoring/zabbix/zabbix_template.py", line 411, in check_template_changed
KeyError: 'macros'



MODULE_STDERR:

Connection to 192.168.121.35 closed.

Work around

If the following patch is applied to the 411th line of ansible / modules / monitoring / zabbix / zabbix_template.py, the error does not occur.

@@ -408,7 +408,7 @@
                     break
 
         if template_macros is not None:
-            existing_macros = existing_template['zabbix_export']['templates'][0]['macros']
+            existing_macros = existing_template['zabbix_export']['templates'][0].get('macros')
             if template_macros != existing_macros:
                 changed = True

Zabbix Agent: Support for multiple servers (firewall, API etc)

Note that Zabbix agent supports a list of IPs for the Server/ServerActive parameters. From zabbix_agentd.conf

### option: server
#       list of comma delimited ip addresses (or hostnames) of zabbix servers.
#       incoming connections will be accepted only from the hosts listed here.
#       no spaces allowed.
#       if ipv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally.
#
# mandatory: yes
# default:
# server=

and

##### active checks related
### option: serveractive
#       list of comma delimited ip:port (or hostname:port) pairs of zabbix servers for active checks.
#       if port is not specified, default port is used.
#       ipv6 addresses must be enclosed in square brackets if port for that host is specified.
#       if port is not specified, square brackets for ipv6 addresses are optional.
#       if this parameter is not specified, active checks are disabled.
#       example: serveractive=127.0.0.1:20051,zabbix.domain,[::1]:30051,::1,[12fc::1]
#

For us, the idea being that the Zabbix agent would register and report to a primary and a backup Zabbix server.

Good news: This mostly already works with ansible-zabbix-agent since we can put a comma-separated list into the zabbix_agent_server and zabbix_agent_serveractive variables

Bad news: This breaks when setting zabbix_agent_firewalld_enable to True (firewalld rich rules only support 1 address). It also breaks the Zabbix API interaction (creation of new hosts etc) since zabbix_url only supports one server

Coming from: dj-wasabi/ansible-zabbix-agent#253
cc: @alexthefifth @mike-anon

Zabbix Server: New Support For Raspbian?

Is your feature request related to a problem? Please describe.
I was trying to set a zabbix server in the raspberry pi and I find zabbix supports Raspian since 3.5, which can be known from both zabbix official doc and its repo

Describe the solution you'd like
Now we don't distinguish Raspbian from Debian using ansible_os_family. Maybe it's better to use ansible_lsb[id]

"ansible_lsb": {
        "codename": "stretch", 
        "description": "Raspbian GNU/Linux 9.8 (stretch)", 
        "id": "Raspbian", 
        "major_release": "9", 
        "release": "9.8"
}, 

Additional context
The same question also appears in other Project involve "Ubuntu" "Debian" and "Raspbian" and they also suggests using ansible_lsb.codename or ansible_lsb.id` instead.

cc: @sonnyhcl

How will the releases of the collection will be executed?

SUMMARY

One of the big upsides of the role/collection separation from the ansible-core is the possibility for the collections to be way more "agile" (yeah I don't like the word too but ...).

How do you plan to go along with this? Doing minor version bumps also on smaller issues every now and then or just going for the big ones slowly?

It would be cool if we maybe even could have a "nightly" branch to test things out even quicker. I know one can always go with the git-repo but in some corporate environments this isn't always possible that easy. A "official" ansible-galaxy pull off some sort would be great here.

ISSUE TYPE
  • Documentation Report

The desc param didn't update of zabbix_maintenance module

SUMMARY

I tried description update of maintenance but it didn't update.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

plugins/modules/zabbix_maintenance.py

ANSIBLE VERSION
# ansible --version
ansible 2.10.0.dev0
CONFIGURATION
# ansible-config dump --only-changed
OS / ENVIRONMENT
CentOS Linux release 7.6.1810 (Core)
STEPS TO REPRODUCE

I have executed the following playbook.

---
- name: test
  hosts: localhost
  gather_facts: no
  collections:
    - community.zabbix
  vars:
    zabbix_server_url: http://127.0.0.1:8080
    zabbix_login_user: Admin
    zabbix_login_password: zabbix
  tasks:
    - name: "test - Update maintenance with a desc param"
      zabbix_maintenance:
        server_url: "{{ zabbix_server_url }}"
        login_user: "{{ zabbix_login_user }}"
        login_password: "{{ zabbix_login_password }}"
        name: maintenance
        host_name: example
        desc: "test description"
        state: present
      register: update_maintenance_desc_result

I changed the desc parameter and re-execute it.

---
- name: test
  hosts: localhost
  gather_facts: no
  collections:
    - community.zabbix
  vars:
    zabbix_server_url: http://127.0.0.1:8080
    zabbix_login_user: Admin
    zabbix_login_password: zabbix
  tasks:
    - name: "test - Update maintenance with a desc param"
      zabbix_maintenance:
        server_url: "{{ zabbix_server_url }}"
        login_user: "{{ zabbix_login_user }}"
        login_password: "{{ zabbix_login_password }}"
        name: maintenance
        host_name: example
        desc: "test description2"
        state: present
      register: update_maintenance_desc_result
EXPECTED RESULTS

The maintenance description will be updated.

ACTUAL RESULTS

The maintenance description didn't update.

Zabbix Web: role shouldn't always remove conf-xxx/zabbix.conf on Debian

Describe the bug
Role always remove default /etc/apache2/conf-available/zabbix.conf config on Debian
even user do not want to install vhost for zabbix

Installation method/version

  • Github / latest

Ansible Version

2.8

Targetted hosts

  • Ubuntu
  • Debian

Expected behavior
Role should not remove default conf-xxx/Zabbix.conf when User do not want to install vhost conf

Possible solution

--- apache_Debian_old.yml	Thu Jun 25 09:29:00 2019
+++ apache_Debian.yml	Wed Jun 26 15:19:40 2019
@@ -27,6 +27,7 @@
   file:
     path: "{{ item }}"
     state: absent
+  when: zabbix_vhost
   with_items:
     - /etc/apache2/conf-available/zabbix.conf
     - /etc/apache2/conf-enabled/zabbix.conf

but may be the role configuration should be like

zabbix_apache_config_style: vhost | conf | skip

copy from: dj-wasabi/ansible-zabbix-web#61
cc: @MVKozlov

zabbix_web is failed

SUMMARY

I'm a user of "dj-wasabi/ansible-zabbix-web".
today I tried to change dj-wasabi/ansible-zabbix-web to community.zabbix.
after that, this error was happen.

fatal: [xxx]: FAILED! => {"changed": false, "msg": "AnsibleError: template error while templating string: Unexpected end of template. Jinja was looking for the following tags: 'elif' or 'else' or 'endif'. The innermost block that needs to be closed is 'if'.. String:
<VirtualHost {{ zabbix_apache_vhost_listen_ip }}:{{ zabbix_apache_vhost_port }}>
  ServerName {{ zabbix_apache_servername }}
(snip... same to this file https://github.com/ansible-collections/community.zabbix/blob/d7932ae8e92945e307ea219b93e4ad9981ea9bb0/roles/zabbix_web/templates/apache_vhost.conf.j2)

It seems simple syntax error of jinja template of apache virtual host config file.
Actually I read the file, It seems to be forget put {% endif %}.

php_value date.timezone {{ zabbix_timezone }}

ISSUE TYPE
  • Bug Report
COMPONENT NAME

zabbix.community.zabbix_web

ANSIBLE VERSION
$ ansible --version
ansible 2.9.9
  config file = None
  configured module search path = ['/Users/taisyo/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/taisyo/.pyenv/versions/3.8-dev/lib/python3.8/site-packages/ansible
  executable location = /Users/taisyo/.pyenv/versions/3.8-dev/bin/ansible
  python version = 3.8.3rc1+ (heads/3.8:bce4dda, May  7 2020, 20:36:09) [Clang 11.0.0 (clang-1100.0.33.16)]
CONFIGURATION
     - role: zabbix_web
        zabbix_web_version: 4.4
        zabbix_url: "{{ inventory_hostname }}"
        zabbix_apache_vhost_port: 8080
        zabbix_timezone: Asia/Tokyo
        apache_listen_port: 8080
        apache_mods_disabled:
          - ssl.load
OS / ENVIRONMENT

MacOS

STEPS TO REPRODUCE

just execute playbook.

EXPECTED RESULTS

successful playbook execution.

ACTUAL RESULTS

error was happen.

fatal: [xxx]: FAILED! => {"changed": false, "msg": "AnsibleError: template error while templating string: Unexpected end of template. Jinja was looking for the following tags: 'elif' or 'else' or 'endif'. The innermost block that needs to be closed is 'if'.. String:
<VirtualHost {{ zabbix_apache_vhost_listen_ip }}:{{ zabbix_apache_vhost_port }}>
  ServerName {{ zabbix_apache_servername }}
(snip... same to this file https://github.com/ansible-collections/community.zabbix/blob/d7932ae8e92945e307ea219b93e4ad9981ea9bb0/roles/zabbix_web/templates/apache_vhost.conf.j2)

zabbix_mediatype parameter renamed in Zabbix 4.4 and onwards

From @atkhan007 on 9 Nov 2019

SUMMARY

Mediatype parameter is renamed from Zabbix 4.4 onwards and it breaks the zabbix_mediatype ansible module.

ISSUE TYPE

Zabbix 4.4 renamed the mediatype parameter from 'description' to 'name', hence breaking the module.

COMPONENT NAME

zabbix_mediatype.py

ANSIBLE VERSION

ansible 2.9.0
config file = /home/user/ansible/ansible.cfg
configured module search path = [u'/home/user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.16 (default, Oct 7 2019, 17:36:04) [GCC 8.3.0]

CONFIGURATION

OS / ENVIRONMENT

Ubuntu 19.04 64-bit 5.0.0-32-generic #34-Ubuntu

STEPS TO REPRODUCE
---
- name: Create Testing mediatype
  zabbix_mediatype:
  name: "Test script"
  server_url: "https://localhost/zabbix/"
  login_user: "Admin"
  login_password: "zabbix"
  type: 'script'
  script_name: 'test_script.sh'
  validate_certs: no
  state: present
EXPECTED RESULTS
TASK [zabbix_server : Create Testing mediatype] ***************************************************************************
changed: [zabbix-server] => {
    "changed": true, 
    "invocation": {
        "module_args": {
            "attempt_interval": 10, 
            "gsm_modem": null, 
            "http_login_password": null, 
            "http_login_user": null, 
            "login_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "login_user": "Admin", 
            "max_attempts": 3, 
            "max_sessions": 1, 
            "message_text_limit": null, 
            "name": "Test script", 
            "password": null, 
            "script_name": "test_script.sh", 
            "script_params": null, 
            "server_url": "https://localhost/********/", 
            "smtp_authentication": false, 
            "smtp_email": null, 
            "smtp_helo": "localhost", 
            "smtp_security": null, 
            "smtp_server": "localhost", 
            "smtp_server_port": 25, 
            "smtp_verify_host": false, 
            "smtp_verify_peer": false, 
            "state": "present", 
            "status": "enabled", 
            "timeout": 10, 
            "type": "script", 
            "username": null, 
            "validate_certs": false
        }
    }, 
    "msg": "Mediatype created: Test script, ID: None"
}
ACTUAL RESULTS
TASK [zabbix_server : Create Testing mediatype] ***************************************************************************
The full traceback is:
WARNING: The below traceback may *not* be related to the actual failure.
  File "/tmp/ansible_********_mediatype_payload_EI1rVw/ansible_********_mediatype_payload.zip/ansible/modules/monitoring/********/********_mediatype.py", line 487, in create_mediatype                                                               
  File "/usr/local/lib/python2.7/dist-packages/********_api.py", line 341, in method
    return self.universal("%s.%s" % (self.data["prefix"], name), opts[0])
  File "/usr/local/lib/python2.7/dist-packages/********_api.py", line 79, in wrapper
    return self.do_request(self.json_obj(method, opts))['result']
  File "/usr/local/lib/python2.7/dist-packages/********_api.py", line 348, in do_request
    return self.parent.do_request(req)
  File "/usr/local/lib/python2.7/dist-packages/********_api.py", line 299, in do_request
    raise ZabbixAPIException(msg, jobj['error']['code'])

fatal: [zabbix-server]: FAILED! => {
    "changed": false, 
    "invocation": {
        "module_args": {
            "attempt_interval": 10, 
            "gsm_modem": null, 
            "http_login_password": null, 
            "http_login_user": null, 
            "login_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "login_user": "Admin", 
            "max_attempts": 3, 
            "max_sessions": 1, 
            "message_text_limit": null, 
            "name": "Test script", 
            "password": null, 
            "script_name": "test_script.sh", 
            "script_params": null, 
            "server_url": "https://localhost/********/", 
            "smtp_authentication": false, 
            "smtp_email": null, 
            "smtp_helo": "localhost", 
            "smtp_security": null, 
            "smtp_server": "localhost", 
            "smtp_server_port": 25, 
            "smtp_verify_host": false, 
            "smtp_verify_peer": false, 
            "state": "present", 
            "status": "enabled", 
            "timeout": 10, 
            "type": "script", 
            "username": null, 
            "validate_certs": false
        }
    }, 
    "msg": "Failed to create mediatype 'Test script': (u'Error -32602: Invalid params., Media type is missing parameters: name while sending {\"params\": {\"status\": \"0\", \"description\": \"Test script\", \"attempt_interval\": \"10\", \"exec_path\": \"test_script.sh\", \"maxattempts\": \"3\", \"maxsessions\": \"1\", \"exec_params\": \"\", \"type\": \"1\"}, \"jsonrpc\": \"2.0\", \"method\": \"mediatype.create\", \"auth\": \"c1e1525971dcddf5a53f74f4303d8da5\", \"id\": 2}', -32602)"     
}

Copied from original issue: ansible/ansible#64604

zabbix_template: incorrect export and import of non-ACSII strings in template [bug]

From @selivan on 17 Apr 2019

SUMMARY

When Zabbix template is saved using state=dump of module zabbix_template, all non-ASCII strings become encoded like this: "\u0422\u0435\u0441\u0442"(this is Russian string "Тест"). On importing this template using state=present, trigger name presented by this string becomes "\u0422\u0435\u0441\u0442" instead of "Тест".

ISSUE TYPE
  • Bug Report
COMPONENT NAME

zabbix_template

ANSIBLE VERSION
ansible 2.7.10
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0]
CONFIGURATION
ANSIBLE_NOCOWS(/home/user/work/ansible/ansible.cfg) = True
ANSIBLE_PIPELINING(/home/user/work/ansible/ansible.cfg) = True
OS / ENVIRONMENT

OS: Ubuntu 16.04 Xenial
Zabbix Server: 4.0

STEPS TO REPRODUCE
- name: Dump Zabbix template
  local_action:
    module: zabbix_template
    server_url: "{{ zabbix_server_url }}"
    login_user: "{{ zabbix_user }}"
    login_password: "{{ zabbix_password }}"
    template_name: "t_test"
    state: dump
  register: template_dump

- name: Save json template
  local_action:
    module: copy
    content: "{{ template_dump['template_json'] }}"
    dest: t_test.json

- name: Import Zabbix Template
  zabbix_template:
    server_url: "{{ zabbix_server_url }}"
    login_user: "{{ zabbix_user }}"
    login_password: "{{ zabbix_password }}"
    template_name: "t_test"
    template_groups:
       - Templates
    state: present
    template_json: "{{ lookup('file', 't_test.json') }}"
EXPECTED RESULTS

Non-ASCII characters in template, like trigger names, should be restored correctly.

ACTUAL RESULTS

Non-ASCII characters in template, like trigger names, are restored in this form: \u0422\u0435\u0441\u0442"/

Copied from original issue: ansible/ansible#55439

Module zabbix_action maintenance_status requires unavailable operator

From @sawicchiraw on 5 Jul 2019

SUMMARY
ISSUE TYPE
  • Bug Report
COMPONENT NAME

zabbix_action

ANSIBLE VERSION
ansible 2.8.2
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.5/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.5.2 (default, Nov 12 2018, 13:43:14) [GCC 5.4.0 20160609]
CONFIGURATION
        conditions:
          - type: 'maintenance_status'
            operator: 'No'
            value: ''
            formulaid: A
OS / ENVIRONMENT

Linux zabbix 4.4.0-154-generic #181-Ubuntu SMP Tue Jun 25 05:29:03 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

STEPS TO REPRODUCE

zabbix 4.0, zabbix api Action object
https://www.zabbix.com/documentation/4.0/manual/api/reference/action/object
When Action operation-conditiontype is 16 - problem is suppressed, it requires new operator "10 - Yes; or 11 - No. "

lib/python3.5/dist-packages/ansible/modules/monitoring/zabbix/zabbix_action.py
line 1391~
try:
return to_numeric_value([
"=",
"<>",
"like",
"not like",
"in",
">=",
"<=",
"not in",
"dammy 8",
"dammy 9",
"Yes",
"No"], _condition['operator']
)

then I can add zabbix action with maintenance_status

EXPECTED RESULTS
ACTUAL RESULTS

Copied from original issue: ansible/ansible#58747

Incorporate CODEOWNERS feature

SUMMARY

At this point this collection should provide both zabbix modules and roles to the community.

We expect some increase in PR/issue monthly load, but nothing horrific, do we want to implement CODEOWNERS github feature?

Dependent on the completion of #24 and merge of devel-roles-migration branch to master.

ISSUE TYPE
  • Feature Idea

Determine release and merge policies for the collection

SUMMARY

Determine and Document!

Repository should at this step already include both zabbix roles and modules. Lets find a common ground on how do we handle merging of new PRs and releasing a new collection versions.

Decision will be affected by the resolution of #25 to some extent.

Probably best discussed at the end of the project

ISSUE TYPE
  • Documentation Report

Initial commit into Ansible Galaxy

SUMMARY

This collection is not yet available in Ansible Galaxy, can we have someone upload it?

ISSUE TYPE
  • Bug Report
COMPONENT NAME
ANSIBLE VERSION

CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.