jdauphant / ansible-role-nginx

Ansible role to install and manage nginx configuration
655 stars 302 forks source link

Add support for configuration snippets #165

Closed realloc closed 7 years ago

realloc commented 7 years ago

It may be useful to have configuration snippets to include in some other configuration files (access list, error pages, TLS settings, etc).

jdauphant commented 7 years ago

Hello @realloc , Thanks for you proposition.

The current solution to do that it's to use ansible templating like that: https://github.com/jdauphant/ansible-role-nginx/pull/33#issuecomment-73109562 (You have the new notation of this role that help you doing that.)

By not introduce snippets in this role, we keep one way do things and we keep the role simple. Don't hesitate to show me stuff we can't do with ansible templating, we will see how we can fix it.

realloc commented 7 years ago

Indeed, templates may be used here, but I try to solve a little bit different problem.

In my case the resulting configuration should be read by humans, so it's better to let them check it in one place. Also when a snippet changes, it would be easier for a human looking at ansible output to understand single file update, rather then many changes in lots of files.

jdauphant commented 7 years ago

Ok good point, could you include an example in the readme ?

realloc commented 7 years ago

Simple example added.

jdauphant commented 7 years ago

Thanks for your help