-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check nginx config before reload that may come from other roles #68
Conversation
Hello @gnarf , Thanks for your pull request. Best regards, |
Also, I forgot but don't hesitate to respond if you have questions or remarks. Julien |
I was adding my own templated .j2 conf to sites-enabled in a later task and wanted to notify the reload from your base nginx plugin. |
also, because of the way it is now, the config check failing stops you from having any unmanaged config files that MIGHT have an error in them... I would think the notify method of checking config is in general cleaner anyway |
If you use this role, all nginx config files should be managed by the role, it's how the role is constructed (and intentionally prevent you to have missconfigured state).
At each call of the role, the configuration is 100% valid. Best regards, PS : If your templates produce only one line or if you have problem with the lookup template, you could need this syntax :
|
Okay so my situation is I have a variable something like: simple_site_configs:
- { name: test1.com, root: /var/www/test1.com }
- { name: test2.com, root: /var/www/test2.com }
- { name: test3.com, root: /var/www/test3.com }
- { name: test4.com, root: /var/www/test4.com } And I want to setup dynamically the Can you suggest how I'd convert from my array of sites to |
Also - I'm trying to do this from within another role, which makes defining each site manually twice not as nice of an option |
I think I have a solution in mind, I will write here when I got the time. |
Hello @gnarf , So review of the PR :
Thanks for your help and this discution, |
Internally updating every use case to also notify "check nginx configuration" works, but I was hoping to avoid forcing consumers of the module to remember to also If anyone is already using your module (like I am) and only notifies I could rename those second stage "really" to In further thought - there is a bit of an issue in that every time this runs, it will leave the config files on the server in a potentially bad state (though ansible will exit with a failure, and you will know) it doesn't actually restore a working configuration when the checks fail. I have thoughts about how to actually accomplish this "restore working config" if you're interested in a followup PR. |
Ok, "reload nginx - after config check" will be better in effect. I will have prefered without "debug" task but apparently we can't do without that. Could be interesting. What approach do you have in mind to do that ? (Backup files before apply rules ?) Thanks again for your help @gnarf , |
Hello @gnarf if you need help for PR or lack of time, don't hesitate to tell |
Thanks for the ping - I had a really busy week(end) hosting an event in NYC, I'll try to remember tomorrow but if you're in a hurry feel free to add the changes you wanted on top here. |
Check nginx config before reload that may come from other roles
Thanks @gnarf |
No description provided.