Rocket.chat.ansible: "AnsibleUndefinedVariable: 'dict object' has no attribute 'iteritems'" reploying service file

Created on 28 Feb 2019  ·  4Comments  ·  Source: RocketChat/Rocket.Chat.Ansible

Deploying to CentOS 7:

TASK [RocketChat.Server : Deploy the Rocket.Chat service file]
fatal: [rocketchat.mydomain.com]: FAILED! => {
    "changed": false,
    "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute 'iteritems'"
}

Any suggestion to the cause/fix?

Most helpful comment

I also get this error and I my ansible version runs in Python 3 on MacOS, installed via homebrew:

$ ansible --version
ansible 2.8.1
  config file = /Users/tanc/Documents/Projects/agile-ansible/ansible.cfg
  configured module search path = ['/Users/tanc/.local/lib/python2.7/site-packages/ara/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.8.1/libexec/lib/python3.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.7.3 (default, Mar 27 2019, 09:23:15) [Clang 10.0.1 (clang-1001.0.46.3)]

All 4 comments

Does this relate to #74 in some way?

The 'Deploy the Rocket.Chat service file' task using rocketchat.service.j2:

{% for variable, value in rocket_chat_service_environment.iteritems() %}
Environment={{ variable }}={{ value }}
{% endfor -%}

Changing it to use rocket_chat_service_environment.items() seemed to fix the problem.

This appears to be an issue with iteritem() being removed in Python 3.
https://stackoverflow.com/questions/30418481/error-dict-object-has-no-attribute-iteritems

I also get this error and I my ansible version runs in Python 3 on MacOS, installed via homebrew:

$ ansible --version
ansible 2.8.1
  config file = /Users/tanc/Documents/Projects/agile-ansible/ansible.cfg
  configured module search path = ['/Users/tanc/.local/lib/python2.7/site-packages/ara/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.8.1/libexec/lib/python3.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.7.3 (default, Mar 27 2019, 09:23:15) [Clang 10.0.1 (clang-1001.0.46.3)]

I also get this error and I my ansible version runs in Python 3 on MacOS, installed via homebrew:

$ ansible --version
ansible 2.8.1
  config file = /Users/tanc/Documents/Projects/agile-ansible/ansible.cfg
  configured module search path = ['/Users/tanc/.local/lib/python2.7/site-packages/ara/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.8.1/libexec/lib/python3.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.7.3 (default, Mar 27 2019, 09:23:15) [Clang 10.0.1 (clang-1001.0.46.3)]

Super valuable, I just searched this error and I am not using rocketchat or homebrew but am using pyenv along with virtualenvironment and had the version set to 2.7.x but no matter what I did with pyenv the virtualenvironment kept using system default. End solution was to use pyenv-virtualenvironment.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BackIsBachus picture BackIsBachus  ·  3Comments

TwizzyDizzy picture TwizzyDizzy  ·  24Comments

dy picture dy  ·  3Comments

dpw picture dpw  ·  3Comments

akxer picture akxer  ·  3Comments