3 # Resource:: systemd_container
5 # Copyright:: 2026, OpenStreetMap Foundation
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # https://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
22 default_action :create
24 property :container, String, :name_property => true
25 property :description, String
26 property :image, String
27 property :command, String
28 property :ports, Hash, :default => {}
29 property :environment, Hash, :default => {}
30 property :volumes, Hash, :default => {}
31 property :pids_limit, Integer
32 property :timeout_start_sec, Integer
33 property :restart, String,
34 :is => %w[on-success on-failure on-abnormal on-watchdog on-abort always]
37 container_variables = new_resource.to_hash
39 template config_name do
41 source "container.erb"
45 variables container_variables
48 execute "systemctl-reload" do
50 command "systemctl daemon-reload"
53 subscribes :run, "template[#{config_name}]"
62 execute "systemctl-reload" do
64 command "systemctl daemon-reload"
67 subscribes :run, "file[#{config_name}]"
73 "/etc/containers/systemd/#{new_resource.container}.container"