manala/ansible-roles

"AnsibleUndefinedVariable: 'dict object' has no attribute 'iteritems'"

setevoy2 opened this issue · 3 comments

Hi.
Got an error during provisioning new EC2:

TASK [manala.logrotate : configs > Templates] ************************************************************************************************************************************************************************************************
failed: [dev.monitor.domain.tld] (item={'file': 'nginx', 'config': [{'/var/log/nginx/.log': [{'size': '100M'}, 'missingok', {'rotate': 5}, 'compress', {'delaycompress': None}, 'notifempty', {'create': '0640 www-data adm'}, 'sharedscripts', 'daily', 'postrotate systemctl reload nginx.service', 'endscript']}]}) => {"changed": false, "item": {"config": [{"/var/log/nginx/.log": [{"size": "100M"}, "missingok", {"rotate": 5}, "compress", {"delaycompress": null}, "notifempty", {"create": "0640 www-data adm"}, "sharedscripts", "daily", "postrotate systemctl reload nginx.service", "endscript"]}], "file": "nginx"}, "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute 'iteritems'"}

Weird a bit, as have your role used for another environment on the previous week and all was good...

Playbook content:

    - role: manala.logrotate
      manala_logrotate_configs:
        - file: nginx
          config:
            - /var/log/nginx/*.log:
              - size: 100M
              - missingok
              - rotate: 5
              - compress
              - delaycompress:
              - notifempty
              - create: 0640 www-data adm
              - sharedscripts
              - daily
              - postrotate
                  systemctl reload nginx.service
              - endscript

Python on the host: 2.7.13
Ansible version: ansible 2.5.4

hyvs commented

Hi.

Try to remove the colon(':') after delaycompress directive.

Hi, @hyvs
Thanks, yeah, that looked weird, but no - didn't help.
I can't understand why the same worked for me on another host in another playbook... With the same Debian, Python, and Ansible :-/

Dead thread. Closing.