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

Warning, Duplicate When Key

Open techzilla opened this issue 6 years ago • 5 comments

 [WARNING]: While constructing a mapping from /run/media/jbecker/archive/Projects/playbook-uniwear/required-roles/nginx/tasks/configuration.yml, line 62, column 3, found a duplicate dict key (when).
Using last defined value only.

When executing a playbook which includes the nginx role, this warning message was displayed. I believe the double when: could be replaced with a list.

techzilla avatar Oct 19 '18 23:10 techzilla

Introduced in this commit: https://github.com/jdauphant/ansible-role-nginx/commit/68633437e49f0e740f4dcae7754e025755ab89c2

rlex avatar Oct 22 '18 10:10 rlex

This commit also introduce by default nginx to load the mod-http-geoip module. It would be better to not load modules by default. Let people decide what have to be loaded

cc @q2digger

gaelL avatar Oct 24 '18 07:10 gaelL

@techzilla @rlex Thanks for the report. If some of you or @q2digger can fix, it will be very nice ;)

@gaelL No worries, it's the documentation, geoip isn't load by default ;)

jdauphant avatar Oct 24 '18 20:10 jdauphant

There is more to it than just fixing "when"

After some digging i think that

(only for RHEL & CentOS).

Is wrong.

Ubuntu, nginx.org repo:

nginx-module-geoip - nginx GeoIP dynamic modules
nginx-module-geoip-dbg - debug symbols for the nginx-module-geoip
nginx-module-image-filter - nginx image filter dynamic module
nginx-module-image-filter-dbg - debug symbols for the nginx-module-image-filter
nginx-module-njs - nginx njs dynamic modules
nginx-module-njs-dbg - debug symbols for the nginx-module-njs
nginx-module-perl - nginx Perl dynamic module
nginx-module-perl-dbg - debug symbols for the nginx-module-perl
nginx-module-xslt - nginx xslt dynamic module
nginx-module-xslt-dbg - debug symbols for the nginx-module-xslt
nginx-nr-agent - New Relic agent for NGINX and NGINX Plus

Debian/ubuntu official repos also have modules (and they are pretty much the same): https://packages.debian.org/search?keywords=libnginx&searchon=names&suite=stable&section=all https://packages.ubuntu.com/search?keywords=libnginx&searchon=names&suite=bionic&section=all

So we have 3 versions of path difference between rhel/debian (maybe load it in vars/{debian,redhat}?) RHEL uses (both mainline and official repos? Can someone with centos/any other rhel confirm?)

/urs/share/nginx/modules

(Worth mentioning that current path specified in task will not work because of "urs" instead of "usr")

Debian:

/usr/share/nginx/modules-available/

And debian from nginx.org repo:

/usr/lib/nginx/modules

This one is tricky - it only installs .so files without configs to enable, so we need to generate configs manually.

Any ideas?

rlex avatar Oct 26 '18 14:10 rlex

ahh ok, I can see the duplicate when statements which are generating this warning.

I have hopefully included a fix for this in PR #235 .

perryk avatar Jan 06 '19 12:01 perryk