8000 Zabbix Web fails on "Install apache vhost" when zabbix_apache_custom_includes is undefined · Issue #985 · ansible-collections/community.zabbix · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Zabbix Web fails on "Install apache vhost" when zabbix_apache_custom_includes is undefined #985
Closed
@mcbrineellis

Description

@mcbrineellis
SUMMARY

It appears that the feature added in #935 is causing an error when zabbix_apache_custom_includes is left undefined.
My playbooks started failing with this bug since the latest release.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

#935

ANSIBLE VERSION
ansible [core 2.13.9]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.11/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.3 (main, Apr 18 2023, 19:33:01) [GCC 12.2.1 20220924]
  jinja version = 3.1.2
  libyaml = False
CONFIGURATION
ANSIBLE_FORCE_COLOR(env: ANSIBLE_FORCE_COLOR) = True
HOST_KEY_CHECKING(env: ANSIBLE_HOST_KEY_CHECKING) = False
OS / ENVIRONMENT / Zabbix Version
  • Ubuntu 20.04
  • Zabbix 6.0
  • Running Ansible in Docker.
STEPS TO REPRODUCE
- name: Install Zabbix Web Frontend
  ansible.builtin.include_role:
    name: community.zabbix.zabbix_web
    apply:
      become: true
  vars:
    zabbix_server_name: "{{ inventory_hostname }}"
    zabbix_web_version: 6.0
    zabbix_api_server_url: "{{ inventory_hostname }}"
    zabbix_server_version: 6.0
    zabbix_server_database: pgsql
    zabbix_server_database_long: postgresql
    zabbix_server_dbport: 5432
    zabbix_server_dbname: zabbix
    zabbix_server_dbuser: zabbix
    zabbix_server_dbpassword: "{{ zabbix6_zabbix_server_dbpassword }}"
    zabbix_timezone: "{{ zabbix6_zabbix_timezone }}"
    zabbix_web_memory_limit: "{{ zabbix6_zabbix_web_memory_limit }}"
    zabbix_web_post_max_size: "{{ zabbix6_zabbix_web_post_max_size }}"
    zabbix_web_upload_max_filesize: "{{ zabbix6_zabbix_web_upload_max_filesize }}"
EXPECTED RESULTS

The task should run fine, even without passing any value for the newly added variable zabbix_apache_custom_includes.

ACTUAL RESULTS
TASK [community.zabbix.zabbix_web : Apache | Install apache vhost] *************
task path: /root/.ansible/collections/ansible_collections/community/zabbix/roles/zabbix_web/tasks/apache.yml:63
<10.10.10.1> ESTABLISH SSH CONNECTION FOR USER: ansible
<10.10.10.1> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/ssh/id_ed25519"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=10 -o 'ControlPath="/root/.ansible/cp/34b2d43aa5"' 10.10.10.1 '/bin/sh -c '"'"'echo ~ansible && sleep 0'"'"''
<10.10.10.1> (0, b'/home/ansible\n', b"OpenSSH_9.3p1, OpenSSL 3.1.0 14 Mar 2023\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug2: resolve_canonicalize: hostname 10.10.10.1 is address\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/root/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/root/.ssh/known_hosts2'\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 469\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n")
<10.10.10.1> ESTABLISH SSH CONNECTION FOR USER: ansible
<10.10.10.1> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/ssh/id_ed25519"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=10 -o 'ControlPath="/root/.ansible/cp/34b2d43aa5"' 10.10.10.1 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/ansible/.ansible/tmp `"&& mkdir "` echo /home/ansible/.ansible/tmp/ansible-tmp-1683758001.5181444-1354-168828736745944 `" && echo ansible-tmp-1683758001.5181444-1354-168828736745944="` echo /home/ansible/.ansible/tmp/ansible-tmp-1683758001.5181444-1354-168828736745944 `" ) && sleep 0'"'"''
<10.10.10.1> (0, b'ansible-tmp-1683758001.5181444-1354-168828736745944=/home/ansible/.ansible/tmp/ansible-tmp-1683758001.5181444-1354-168828736745944\n', b"OpenSSH_9.3p1, OpenSSL 3.1.0 14 Mar 2023\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug2: resolve_canonicalize: hostname 10.10.10.1 is address\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/root/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/root/.ssh/known_hosts2'\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 469\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n")
<10.10.10.1> ESTABLISH SSH CONNECTION FOR USER: ansible
<10.10.10.1> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/ssh/id_ed25519"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=10 -o 'ControlPath="/root/.ansible/cp/34b2d43aa5"' 10.10.10.1 '/bin/sh -c '"'"'rm -f -r /home/ansible/.ansible/tmp/ansible-tmp-1683758001.5181444-1354-168828736745944/ > /dev/null 2>&1 && sleep 0'"'"''
<10.10.10.1> (0, b'', b"OpenSSH_9.3p1, OpenSSL 3.1.0 14 Mar 2023\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug2: resolve_canonicalize: hostname 10.10.10.1 is address\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/root/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/root/.ssh/known_hosts2'\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 469\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n")
The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/ansible/template/__init__.py", line 1128, in do_template
    res = self.environment.concat(rf)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/ansible/template/native_helpers.py", line 88, in ansible_concat
    return ''.join([to_text(v) for v in nodes])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/ansible/template/native_helpers.py", line 88, in <listcomp>
    return ''.join([to_text(v) for v in nodes])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<template>", line 89, in root
  File "/usr/lib/python3.11/site-packages/jinja2/tests.py", line 195, in test_iterable
    iter(value)
  File "/usr/lib/python3.11/site-packages/jinja2/runtime.py", line 852, in _fail_with_undefined_error
    raise self._undefined_exception(self._undefined_message)
jinja2.exceptions.UndefinedError: 'zabbix_apache_custom_includes' is undefined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/ansible/plugins/action/template.py", line 138, in run
    resultant = templar.do_template(template_data, preserve_trailing_newlines=True, escape_backslashes=False)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/ansible/template/__init__.py", line 1162, in do_template
    raise AnsibleUndefinedVariable(e)
ansible.errors.AnsibleUndefinedVariable: 'zabbix_apache_custom_includes' is undefined
fatal: [zabbix.myhostname.net]: FAILED! => {
    "changed": false,
    "msg": "AnsibleUndefinedVariable: 'zabbix_apache_custom_includes' is undefined"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0