X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/52a5ec535e5a578e8450c94ac19a4e8681b88140..c6294e91397c6feebd9b9f0e33da615b3ca17998:/cookbooks/podman/resources/service.rb?ds=inline diff --git a/cookbooks/podman/resources/service.rb b/cookbooks/podman/resources/service.rb index 6ce5da35e..6052b7fb2 100644 --- a/cookbooks/podman/resources/service.rb +++ b/cookbooks/podman/resources/service.rb @@ -41,9 +41,16 @@ action :create do restart "on-failure" end + # No action :start here to avoid a start and then immediate :restart, due to subscribe, on first run service new_resource.service do - action [:enable, :start] - subscribes :restart, "systemd_service[#{new_resource.service}]" + action :enable + subscribes :restart, "systemd_service[#{new_resource.service}]", :immediately + end + + # Ensure the service is started if not running, replies on status of service resource + notify_group new_resource.service do + action :run + notifies :start, "service[#{new_resource.service}]", :immediately end end