How does one get to a single restart/reload on a single chef run and be within chef best practices?
Is using a status file a good practice or re-writing the service dnsmasq information?
This question was asked 7 years ago, has someone found a better way?
Re-writing service documented here --
Minimize service restarts from chef notifications?
Issue:
The current code has resulted in 1 restart and 1 reload. Which has caused issues.
dnsmasq has 3 configuration files that need to be managed with different start/restart/reload methods. dnsmasq has no-poll as an argument by design, to prevent it from reloading /etc/resolv.conf on every change. I want to control the reloads here.
package "install dnsmasq" do
name 'dnsmasq'
action :install
notifies :create, 'cookbook_file[/etc/dnsmasq.conf]', :delayed
notifies :create, 'template[/etc/resolv.dnsmasq]', :delayed
notifies :create, 'template[/etc/resolv.conf]', :delayed
notifies :restart, 'service[dnsmasq]', :delayed
end
template '/etc/resolv.dnsmasq' do
...
notifies :reload, 'service[dnsmasq]', :delayed
end
file '/etc/dnsmasq.conf' do
...
notifies :restart, 'service[dnsmasq]', :delayed
end
template '/etc/resolv.conf' do
...
notifies :reload, 'service[dnsmasq]', :delayed
end
service 'dnsmasq' do
supports [:restart, :status, :start, :reload]
action [ :enable, :start ]
reload_command "/usr/bin/killall -s SIGHUP dnsmasq"
end
:reloadrequired at all, as service:restartis also requested? IMHO one restart at the end after updating all configuration files should be enough.