nginx/ansible-role-nginx-config

Manage custom directories

Closed this issue · 3 comments

Is your feature request related to a problem? Please describe

I'm always frustrated when I need to use the collection and specify custom paths in nginx.conf and need to manage them with custom task. Example:
I want to add to /etc/nginx/nginx.conf
client_body_temp_path /var/nginx/client_body_temp;

This directory is /var/nginx not created and have not found a way to create custom configs using this role.

Describe the solution you'd like

Add a role variable that would allow creation of custom dirs.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

I hear you. The role already innately manages new directories for proxy_temp_path, I could probably backport that functionality to other directives that involve creating new directories.

In the meantime, that's something you can already easily accomplish using pre-tasks or a task before you include the role (depends on whether you are using the legacy roles: or the newer include_roles: parameter).

@alessfg Not sure how to manage directory owner in that case. By default it should be owned by nginx user. Moving this to a pre-task will also involve moving of user management out of the role. Or I'm missing smth?

Creating the directory as root in pre-tasks: should work. NGINX will readjust permissions once the role reloads the config.