]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/systemd/templates/default/service.erb
Add a systemd cookbook to manage unit files
[chef.git] / cookbooks / systemd / templates / default / service.erb
diff --git a/cookbooks/systemd/templates/default/service.erb b/cookbooks/systemd/templates/default/service.erb
new file mode 100644 (file)
index 0000000..13983b0
--- /dev/null
@@ -0,0 +1,39 @@
+[Unit]
+Description=<%= @description %>
+<% if @after -%>
+After=<%= Array(@after).join(" ") %>
+<% end -%>
+
+[Service]
+Type=<%= @type %>
+<% if @limit_nofile -%>
+LimitNOFILE=<%= @limit_nofile %>
+<% end -%>
+<% @environment.each do |name,value| -%>
+Environment="<%= name %>=<%= value %>"
+<% end -%>
+<% if @environment_file -%>
+EnvironmentFile=<%= @environment_file %>
+<% end -%>
+<% if @exec_start_pre -%>
+ExecStartPre=<%= @exec_start_pre %>
+<% end -%>
+ExecStart=<%= @exec_start %>
+<% if @exec_start_post -%>
+ExecStartPost=<%= @exec_start_post %>
+<% end -%>
+<% if @exec_stop -%>
+ExecStop=<%= @exec_stop %>
+<% end -%>
+<% if @exec_reload -%>
+ExecReload=<%= @exec_reload %>
+<% end -%>
+<% if @restart -%>
+Restart=<%= @restart %>
+<% end -%>
+<% if @timeout_sec -%>
+TimeoutSec=<%= @timeout_sec %>
+<% end -%>
+
+[Install]
+WantedBy=multi-user.target