Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running Playbook - no filter named 'items2dict' #662

Closed
steelcityrkp opened this issue Oct 1, 2020 · 3 comments
Closed

Running Playbook - no filter named 'items2dict' #662

steelcityrkp opened this issue Oct 1, 2020 · 3 comments

Comments

@steelcityrkp
Copy link

steelcityrkp commented Oct 1, 2020

We have used this Playbook to install Matrix Synapse / Riot nearly a year and a half-ago. Had everything working fine, and had even made multiple updates through the Playbook in following months.

However, it has been some time since running the playbook, and we have tried to run it now, but it has been unsuccessful. There were a number of minor things that we needed to do (changing dashes to underscore, host_vars to vars, etc.) and we are able to run the playbook as intended.

However we keep running into this problem and the Playbook just fails and now our Synapse service is down, and we are not able to back up our DB either. I try to avoid raising an issue just for the aspect of troubleshooting or supporting my problem; however, after trying various things over several days, it does seem to me that this is an actual issue of the Playbook (or at-least the documentation on how it should be run). As this occurs, just following the instructions as is.

It seems like this is related to maybe some kind of dependency not loading? (I don't know too much about ansible):

{"msg": "The conditional check 'vars | dict2items | selectattr('key', 'match', item.old) | list | items2dict' failed. The error was: template error while templating string: no filter named 'items2dict'. String: {% if vars | dict2items | selectattr('key', 'match', item.old) | list | items2dict %} True {% else %} False {% endif %}\n\nThe error appears to have been in '/work/roles/matrix-client-element/tasks/validate_config.yml': line 11, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: (Deprecation) Catch and report riot-web variables\n ^ here\n"}

Any insights would be appreciated. More-so, however, I think this is important to note as an issue.

I would like to note that there is no references to Riot in any of our Vars; however, I don't think this is the issue as the actual intended task is failing (not giving the message it should if the check itself is running correctly)

@aaronraimist
Copy link
Contributor

What version of Ansible are you using? What commit of the playbook?

You should be able to start the services manually on the server with something like sudo systemctl start matrix-synapse and sudo systemctl start matrix-postgres etc while you fix this issue.

@steelcityrkp
Copy link
Author

@aaronraimist , these were helpful questions that lead us towards a solution that ended up working. Thank you.

We have everything running and working with the current commit of the playbook, right now.
I am going to close the issue, but will try to highlight a little bit of what we needed to in case it may be helpful to anyone else that is in a similar situation running into similar issues (working installation from playbook, revisited after sometime):
These are all in the current documentation, but are changes from older documentation that we didn't explicitly know until troubleshooting

  • We needed to change host_vars.yml to vars.yml for the file name within the particular host configuration directory
  • We needed to change [matrix-servers] [matrix_servers] in the hosts file within the main inventory directory
  • We had been running Ansible from a different docker image that was in prior version of documentation (qmxme/ansible) and the current documentation refers to this docker image: (devture/ansible:2.9.9-r0). Changing this one thing is what solved this particular issue (the items2dict triggering a fail).

I want to highlight this for anyone that is encountering this, as it may be easy to overlook due to the fact that prior docker image meets the Ansible version requirements, but I guess something isn't fully set in the container for newer updates to the playbook

Appreciate all the work that everyone put in the Playbook. It is hard to imagine trying to set up all this ourselves (none of these particular languages and environments are in our team's wheelhouse).

spantaleev added a commit that referenced this issue Oct 2, 2020
Interestingly, no one has reported this failure before #662 (Github
Issue).

It doesn't make sense to keep saying that we support such old Ansible
versions, when we're not even testing on anything close to those.

Time is also passing and such versions are getting more and more
ancient. It's time we bumped our requirements to something that is more
likely to work.
@spantaleev
Copy link
Owner

qmxme/ansible:latest is 2 years old as of now and appears to be Ansible v2.5.5.

I imagined that the playbook required >= 2.5.2. We also have a version check for this in roles/matrix-base/tasks/sanity_check.yml.

However, looking at the Ansible documentation here, it seems like dict2items has been added in Ansible v2.6 and items2dict was introduced in Ansible v2.7.

We only use these filters in a few non-critical places right now:

roles/matrix-client-element/tasks/validate_config.yml
18:  when: "vars | dict2items | selectattr('key', 'match', item.old) | list | items2dict"

roles/matrix-ma1sd/tasks/validate_config.yml
54:  when: "vars | dict2items | selectattr('key', 'match', item.old) | list | items2dict"
64:  when: "vars | dict2items | selectattr('key', 'match', item.old) | list | items2dict"

I'm guessing we should either replace this with something else or bump the version requirement to v2.7. I've bumped the version requirement to v2.7 in 23daec7. Thanks for reporting this issue! 👍

spantaleev added a commit that referenced this issue Oct 2, 2020
Related to 23daec7 and #662 (Github Issue).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants