template error while templating string: no filter named 'failed'

4,584 views
Skip to first unread message

Nicola Limongi

unread,
Apr 27, 2021, 9:23:37 AM4/27/21
to Ansible Project
Hi all!

I'm having an issue while running the task at line 14 of this role:

The error is the following:
 TASK [ansible-go : Remove old installation of Go] ******************************
fatal: [ubuntu1804]: FAILED! => {"msg": "The conditional check 'go_version|failed or go_version.stdout != go_version_target' failed. The error was: template error while templating string: no filter named 'failed'. String: {% if go_version|failed or go_version.stdout != go_version_target %} True {% else %} False {% endif %}\n\nThe error appears to be in '/home/vagrant/.cache/molecule/ansible/default/roles/ansible-go/tasks/main.yml': line 14, 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: Remove old installation of Go\n  ^ here\n"}

I see the filter "failed" documented in Jinja2 here. Why is it not working?

MY ENV:
ansible --version
ansible 2.10.7
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/vagrant/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/vagrant/venv_automation/lib/python3.6/site-packages/ansible
  executable location = /home/vagrant/venv_automation/bin/ansible
  python version = 3.6.9 (default, Jan 26 2021, 15:33:00) [GCC 8.4.0]


Nicola

Sam Doran

unread,
Apr 27, 2021, 9:48:37 AM4/27/21
to ansible...@googlegroups.com
Nicola,

Using tests as filters was deprecated in Ansible 2.5 and removed in 2.9.


---

Respectfully,

Sam Doran
Ansible Core

Nicola Limongi

unread,
Apr 27, 2021, 9:52:50 AM4/27/21
to ansible...@googlegroups.com
Hi Sam,
thanks a lot for pointing that out.

thanks for your time,
Nicola

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/NPvqtFrHHl8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CABDC858-4D5A-48E4-8186-84F920F08D61%40redhat.com.
Reply all
Reply to author
Forward
0 new messages