nickjj / ansible-nginx

Install and configure nginx (SSL A+ by default) with Ansible.
MIT License
73 stars 37 forks source link

no filter named 'changed' with Ansible 2.9.6 #22

Closed marcinkoziej closed 2 years ago

marcinkoziej commented 4 years ago

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.

nickjj commented 4 years ago

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.