On 9/29/16 9:52 AM, Ugo Bellavance wrote: > > > On Wednesday, September 28, 2016 at 8:07:26 PM UTC-4, Ugo Bellavance wrote: > > > > On Wednesday, September 28, 2016 at 4:35:50 PM UTC-4, Garrett > Honeycutt wrote: > > On 9/28/16 3:54 PM, Ugo Bellavance wrote: > > Hi, > > > > I am working with this module > https://github.com/voxpupuli/puppet-nginx > <https://github.com/voxpupuli/puppet-nginx> > > to get some nginx servers up. Here is my hiera config for a > vhost: > > > > nginx::nginx_vhosts: > > 'website1.domain.com <http://website1.domain.com>': > > proxy: 'http://website1.internal' > > > > I would like to have my logs in one directory per vhost. > > > > Here is what I have for now: > > > > nginx::http_access_log: > "%{hiera('nginx::config::log_dir')}/access_log" > > > > > > In the template, it looks like that: > > > > "${::nginx::config::log_dir}/${name_sanitized}.access.log > ${format_log}", > > > > Would there be a way to set it in hiera so that it is the > equivalent of > > this: > > > > "${::nginx::config::log_dir}/${name_sanitized}/access.log > ${format_log}", > > > > Of course, I would like to avoid having to edit the template. > > > > Thanks, > > > > Hi Ugo, > > nginx_vhosts has a parameter named access_log. You could use > that as > follows. > > nginx::nginx_vhosts: > 'website1.domain.com <http://website1.domain.com>': > proxy: 'http://website1.internal' > access_log: '/whatever/access.log' > > > https://github.com/voxpupuli/puppet-nginx/blob/master/manifests/resource/vhost.pp#L145 > > <https://github.com/voxpupuli/puppet-nginx/blob/master/manifests/resource/vhost.pp#L145> > > > > Makes sense, I didn't see that one. In fact I was looking for a way > to make it automatic instead of always have to enter the log path. > > > I tested it but the system complains that the directory doesn't exist. > I wonder how I could easily create a folder for each vhost, and I don't > know how it could be managed automatially in the module since puppet > doesn't create parent directories for File directives. It looks like > I'll have to stick to the default. > > That makes me think of something. Could I enumerate the names of all my > vhosts in hiera, and have only one vhost directive? Something like > here https://blog.serverdensity.com/deploying-nginx-with-puppet/ but > with something like a table of vdomain values. > > It looks very hard to find relevant information on how to use hiera... > but it is such an excellent tool! >
Hi Ugo, Suggest creating a profile class that includes nginx as well as ensuring that all those directories exist first. An alternative would be to send a pull request to the nginx module that runs `mkdir -p` for you when specifying a custom access_log. Best regards, -g -- Garrett Honeycutt @learnpuppet Puppet Training with LearnPuppet.com Mobile: +1.206.414.8658 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/64c906b4-8214-c635-ef83-edba0469c517%40garretthoneycutt.com. For more options, visit https://groups.google.com/d/optout.