Collective config validation & "extra options" #36
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey Jeff!
Thanks for the great role 馃憤
Hoping you'll happily accept these contributions (with any modifications you see fit, of course).
These changes bring a collective validation of the deployed Nginx configuration and the option to define arbitrary "extra" configuration options for the top-level
http
block in/etc/nginx.conf
.validate
param on the deployment of the/etc/nginx.conf
file. This will ensure the Nginx config (including any included configs) are valid, according tonginx -t
. I had to move the deployment of vhosts above the deployment of thenginx.conf
file, to ensure all config was in place before testing (see my commit message on cc5114d for more details).restart nginx
was being called.If an invalid configuration is deployed, it will run this notifier first, so, in the case that
/etc/nginx.conf
doesn't change, but a vhost config does, and as such does not trigger the above mentionedvalidate
param, and it introduces some bad config, Ansible will fail upon running the validate handler, so it'll exit before it has a chance (fail) to restart the Nginx service - meaning, you're at least not left with a broken web server :)nginx_extra_options
variable that will allow the user to define (literally, using Nginx syntax) extra configuration they want to add to thehttp
block. I elaborate on this in the commit: c5a2143, in the README, and lastly in an example comment indefaults/main.yml
.