service "haproxy" do supports :restart => true, :status => true, :reload => true action :nothing # only define so that it can be restarted if the config changed end template "/etc/haproxy/haproxy.cfg" do cookbook "haproxy" source "haproxy.cfg.erb" owner "root" group "root" mode 0644 notifies :reload, "service[haproxy]" end execute "echo 'checking if HAProxy is not running - if so start it'" do not_if "pgrep haproxy" notifies :start, "service[haproxy]" end