dj-wasabi / ansible-zabbix-agent

Installing and maintaining zabbix-agent for RedHat/Debian/Ubuntu/Windows/Suse.
https://galaxy.ansible.com/dj-wasabi/zabbix-agent
MIT License
327 stars 248 forks source link

Error in: Create directory for PSK file if not exist #92

Closed dsteinkopf closed 7 years ago

dsteinkopf commented 7 years ago

Running the new version 1.0.0 I get the following error:

task path: /etc/ansible/roles/dj-wasabi.zabbix-agent/tasks/main.yml:115
The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 125, in run
    res = self._execute()
  File "/usr/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 462, in _execute
    self._task.post_validate(templar=templar)
  File "/usr/lib/python2.7/dist-packages/ansible/playbook/task.py", line 247, in post_validate
    super(Task, self).post_validate(templar)
  File "/usr/lib/python2.7/dist-packages/ansible/playbook/base.py", line 373, in post_validate
    value = templar.template(getattr(self, name))
  File "/usr/lib/python2.7/dist-packages/ansible/template/__init__.py", line 481, in template
    disable_lookups=disable_lookups,
  File "/usr/lib/python2.7/dist-packages/ansible/template/__init__.py", line 437, in template
    disable_lookups=disable_lookups,
  File "/usr/lib/python2.7/dist-packages/ansible/template/__init__.py", line 659, in do_template
    res = j2_concat(rf)
  File "<template>", line 9, in root
  File "/usr/lib/python2.7/dist-packages/ansible/utils/unicode.py", line 66, in unicode_wrap
    return to_text(func(*args, **kwargs), nonstring='passthru')
  File "/usr/lib/python2.7/posixpath.py", line 122, in dirname
    i = p.rfind('/') + 1
AttributeError: 'NoneType' object has no attribute 'rfind'
fatal: [docker3]: FAILED! => {
    "failed": true, 
    "msg": "Unexpected failure during module execution.", 
    "stdout": ""
}

My ansible playbook looks like this:

- name: install zabbix agent
  hosts: all

  become: true
  become_user: root

  # see https://github.com/dj-wasabi/ansible-zabbix-agent

  roles:
    - role: dj-wasabi.zabbix-agent
      when: not (ansible_distribution == 'Ubuntu' and ansible_distribution_version == '12.04')
      zabbix_agent_server: "{{ zabbix_agent_server_dstk }}"
      zabbix_agent_serveractive: "{{ zabbix_agent_serveractive_dstk }}"
      zabbix_agent_timeout: 12
      zabbix_agent_enableremotecommands: 1
      zabbix_agent_logremotecommands: 1
      zabbix_version: 3.2
      # LogType can't be set here so syslog geht nicht. see https://www.zabbix.com/documentation/3.4/manual/appendix/config/zabbix_agentd
      # agent_logfile: # empty = syslog
      # zabbix_agent_logfile: # empty = syslog
      zabbix_url: http://zabbixsrv.xxx:8083/
      zabbix_api_user: Admin
      zabbix_api_pass: xxx
      zabbix_api_create_hosts: zabbix_api_create_hosts_dstk
      zabbix_create_host: present
      zabbix_host_groups:
        - Linux servers
      zabbix_link_templates:
        - Template Linux Mine

Is this a bug or an error in my side?

dj-wasabi commented 7 years ago

Hi. Do you have the property zabbix_agent_tlspskfile configured somewhere?

dsteinkopf commented 7 years ago

no (just double checked.)

dsteinkopf commented 7 years ago

What can I do to further analyze the problem?

dj-wasabi commented 7 years ago

@dsteinkopf Nothing at the moment. Busy with a fix now. Will create a PR this morning.

dj-wasabi commented 7 years ago

I merged the PR, so should work now.

dj-wasabi commented 7 years ago

I have created release 1.0.1 and pushed it to the Galaxy.

dsteinkopf commented 7 years ago

Thank you very much, I will try it when it's available.

dsteinkopf commented 7 years ago

That seems to work in 1.0.1 - but I fear I've found another problem. I am further investigating and will create another bug ticket.