ANXS / nginx

A fairly flexible and feature full Ansible role for the NGINX web server.
MIT License
151 stars 82 forks source link

Fix nginx_sites option #89

Closed brainwire closed 7 years ago

UnderGreen commented 7 years ago

Hi, Vadim.

Why you need to add when clause? By default nginx_sites: [] and impossible to compare this value with none. And you don't need to compare it.

brainwire commented 7 years ago

Hi, @UnderGreen ! By default I get one error: image

I set options: nginx_sites: "none" nginx_enabled_sites: "none" nginx_disabled_sites: "none" But still get the error:: image

brainwire commented 7 years ago

Ping!

issa-tseng commented 7 years ago

I believe the root cause of this issue is actually addressed by my PR #90; the problem here is that the with_items statement on the previous line L19 (and all other instances in the file) are being read by modern Ansible versions as a literal rather than a variable reference. So rather than evaluating [], it's evaluating "nginx_sites". So then when L14 attempts to get the .server.name property of the iteration var, it can't find it because it's iterating on a string.

So your fix here works for folks who provide 'none' sites by ignoring the whole block, but covers up the real error on the previous line.

otakup0pe commented 7 years ago

This was fixed in https://github.com/ANXS/nginx/pull/90 and has been merged.