ansible-nginx icon indicating copy to clipboard operation
ansible-nginx copied to clipboard

no filter named 'changed' with Ansible 2.9.6

Open marcinkoziej opened this issue 5 years ago • 1 comments

Hi! I'm using this role with ansible 2.9.6. The task "Forcefully restart nginx", generates this error:

fatal: [....]: FAILED! => {
 "msg": "The conditional check '(nginx_register_nginx_config | changed) and (nginx_register_vhost_config | changed)' failed. The error was: template error while templating string: no filter named 'changed'. 
 String: {% if (nginx_register_nginx_config | changed) and (nginx_register_vhost_config | changed) %} True {% else %} False {% endif %}

The error appears to be in '/home/marcin/.ansible/roles/nickjj.nginx/tasks/main.yml': line 111, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

- name: Forcefully restart nginx
  ^ here
}

This seems to work if I change the syntax to: nginx_register_vhost_config is changed, but I am not sure how to fix this so it is backward compatible.

marcinkoziej avatar Jul 22 '20 17:07 marcinkoziej

Hi,

Yep, your proposed change is how to fix it. It's been a warning level thing for a while. I'm in the process of rewriting a lot of roles which is why I haven't maintained this role much for things like this.

nickjj avatar Jul 22 '20 17:07 nickjj