Open BenBE opened 6 years ago
Thanks for the report.
It's an unexpected behavior. Normally, default should be removed and if you replace "nginx_sites", no new default should be added. https://github.com/jdauphant/ansible-role-nginx/blob/a6aa5ed94a05ba84ec48a1e20bf203eafcbffe5a/tasks/remove-defaults.yml Can you name what files are in your filesystem after the role launch, is it sites-enabled/default.conf or sites-enabled/default ?
The file is sites-enabled/default.conf
Locally using commit 68633437e49f0e740f4dcae7754e025755ab89c2
Further note: Running FreeBSD on that host; using the role to configure inside a cbsd jail.
Running with ansible 2.5.1 on Ubuntu; in case this matters.
Ok the file should not exist if it's not defined by you. What's the content ? It's what specify here : https://github.com/jdauphant/ansible-role-nginx/blob/master/defaults/main.yml#L49 or another things ? Do you have "nginx_keep_only_specified" at False (default) or True ?
The created (and activate) default site (cf. defaults/main.yml) causes interference with configurations where the default host should be configured using a template (either cause a warning about duplicate sites or need to unconfigure things coming from the defaults). Would be nice if there was a simple way to suppress creation of the default site in cases I really want just a bare nginx with only the settings visible in my playbook.
Sample:
Expected behaviour: Produces only one site (enabled) named foo.
Actual behaviour: Produces two sites (enabled) called default and foo.
Workaround:
NB: Only removing default, without disabling it causes a templating error.
Alternatively /causing a warning on execution) you could override default:
Possible desired config: