restart NginX ONCE (after default file has been removed)

249 views
Skip to first unread message

Steve Button

unread,
Mar 3, 2017, 7:00:36 AM3/3/17
to Puppet Users
Hi,

I've got a small piece of puppet in my profile module to remove the default nginx.conf file which gets installed by the nginx module. 

# Upon install this file gets created and displays "Welcome to NginX" page, which we don't need.
file { '/etc/nginx/conf.d/default.conf':
ensure => 'absent',
# Need to force NGinx to restart after this change has completed so we don't get a default page.
notify => Service['ningx'],
}

However this fails because the service is defined within with NginX module, not the profile. 

Am I going about this in the wrong way? 

Obviously I don't want it to restart every time Puppet runs, only triggered by the file being removed.

I was to avoid modifying the component module https://forge.puppet.com/puppet/nginx if at all possible.

Thanks,

Michael Watters

unread,
Mar 3, 2017, 8:18:15 AM3/3/17
to Puppet Users
notify events are queued and grouped together so nginx should only be restarted once when puppet runs.  You may also need to include nginx in your profile so that the service is properly defined.

Michael Watters

unread,
Mar 3, 2017, 8:26:16 AM3/3/17
to Puppet Users
Also, it looks like somebody tried to fix this previously but the changes weren't merged in.  See https://github.com/voxpupuli/puppet-nginx/issues/333 for example.  IMO there should be a class parameter to control this behavior so you might want to submit a PR with any changes you make.


On Friday, March 3, 2017 at 7:00:36 AM UTC-5, Steve Button wrote:
Reply all
Reply to author
Forward
0 new messages