Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

Warning, Duplicate When Key #233

Open
techzilla opened this issue Oct 19, 2018 · 5 comments
Open

Warning, Duplicate When Key #233

techzilla opened this issue Oct 19, 2018 · 5 comments

Comments

@techzilla
Copy link

 [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.

@rlex
Copy link

rlex commented Oct 22, 2018

Introduced in this commit:
6863343

@gaelL
Copy link

gaelL commented Oct 24, 2018

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

@jdauphant
Copy link
Owner

@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 ;)

@rlex
Copy link

rlex commented Oct 26, 2018

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?

@perryk
Copy link
Contributor

perryk commented Jan 6, 2019

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 .

jdauphant pushed a commit that referenced this issue Jan 8, 2019
* Fix typo in modules config and restrict to EPEL (#232)

* Fixes warning from duplicate when's in modules configuration (#233)
mrwacky42 added a commit to HeadspaceMeditation/ansible-role-nginx that referenced this issue Jan 18, 2020
* Explicitly setting the nginx configuration file in (jdauphant#223)

the "check nginx configuration" handler.

* Fixing Ansible 2.7.0 deprication warnings (jdauphant#225)

* * Fixing Ansible 2.7.0 deprication warnings
  For further details take a look at: https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_2.7.html#using-a-loop-on-a-package-module-via-squash-actions

* * Remving travis deprecation warning - Moving from "--sudo" to "--become"

* * Ignoring symlinks errors during ansible_check_mode

* Small spelling correction (jdauphant#228)

* Add support to declare nginx modules in config file (jdauphant#227)

* We can declare nginx modules now

* We can declare nginx modules now

* Correct load_module definition in template

* Add task to remove `default.conf` from sites-enabled/ (jdauphant#231)

* Add task to remove `default.conf` from sites-enabled/

* Check if `default` site is not inside user config

* fix modules definition and add README section about this feature (jdauphant#232)

* Fix typo in modules config and restrict to EPEL (jdauphant#232) (jdauphant#235)

* Fix typo in modules config and restrict to EPEL (jdauphant#232)

* Fixes warning from duplicate when's in modules configuration (jdauphant#233)

* Extends support for configuring modules (jdauphant#236) (jdauphant#237)

Module configuration should now work for the following:

 Centos/RHEL with either EPEL or Official Nginx repo
 Debian/Ubuntu with either standard APT repo or Official Nginx repo

Please see issue jdauphant#236 for further details.

* Update README.md

* download mime.types file if it's missing (jdauphant#241)

* configuration: allow templates for conf.d independent files (jdauphant#238)

* Fix for jdauphant#242 Stick to ansible-lint rules. (jdauphant#243)

* trailing whitespace

* [701] Role info should contain description

* [601] Don't compare to literal True/False

* [502] All tasks should be named

* [206] Variables should have spaces before and after: {{ var_name }}

* skip_ansible_lint rule [403] Package installs should not use latest

* [204] Lines should be no longer than 160 chars

Co-authored-by: Timo Runge <timorunge@users.noreply.github.com>
Co-authored-by: TheSycamore <TheSycamore@users.noreply.github.com>
Co-authored-by: Dmitry Ge <22640222+q2digger@users.noreply.github.com>
Co-authored-by: Tommaso <p.tommy93@gmail.com>
Co-authored-by: Perry Kollmorgen <pcjkollmorgen@hotmail.com>
Co-authored-by: Julien DAUPHANT <jdauphant@users.noreply.github.com>
Co-authored-by: Tony Crowe <hellotonycrowe@protonmail.com>
Co-authored-by: paulrbr-fl <43074087+paulrbr-fl@users.noreply.github.com>
Co-authored-by: Bas <bas.meijer@me.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants