I’m using the ruby_block resource to write the contents of a secure databag
item into /home/deploy/.ssh (a private key). Problem is, that directory has
restricted permissions, and the key is not saved. Here’s the code I’m using:
ruby_block “write_key” do
f = ::File.open("/home/deploy/.ssh/id_deploy",“w”)
not_if do ::File.exists?("/home/deploy/.ssh/id_deploy"); end
Is there a way to tell ruby_block to run as another user? Or is there a
better way to do that?