chef/site-cookbooks/kosmos_encfs/resources/encfs_path_activation_unit.rb

22 lines
496 B
Ruby

resource_name :encfs_path_activation_unit
property :service_name, String, required: true, name_property: true
action :create do
systemd_unit "#{new_resource.service_name}.path" do
content <<-EOF
[Unit]
Description=Start #{new_resource.service_name} when encrypted data directory is mounted
[Path]
PathExists=/tmp/data-dir-mounted.txt
Unit=#{new_resource.service_name}
[Install]
WantedBy=multi-user.target
EOF
triggers_reload true
action [:create, :enable, :start]
end
end