Get content from cookbook_file


#1

Hello,

i copy private and public keys from my cookbook files with:

remote_directory “/home/jenkins/.ssh” do
files_mode '0600’
files_owner 'jenkins’
files_group 'jenkins’
mode '0700’
owner 'jenkins’
source "deploy_keys"
notifies :run, “execute[fix-pubkey-rights]”, :immediately
end

execute “fix-pubkey-rights” do
cwd "/home/jenkins/.ssh"
command "chmod 0644 *.pub"
action :nothing
end

Now i wan’t iterate over all private keys and use the content and name with

jenkins_private_key_credentials “#{filename}” do
description "#{filename} pivate key for github access"
private_key "#{content}"
end

Hoiw can i do this?


#2

On 10/21/2014 7:13 AM, info@nevalon.de wrote:

Hello,

i copy private and public keys from my cookbook files with:

remote_directory “/home/jenkins/.ssh” do
files_mode '0600’
files_owner 'jenkins’
files_group 'jenkins’
mode '0700’
owner 'jenkins’
source "deploy_keys"
notifies :run, “execute[fix-pubkey-rights]”, :immediately
end

execute “fix-pubkey-rights” do
cwd "/home/jenkins/.ssh"
command "chmod 0644 *.pub"
action :nothing
end

Now i wan’t iterate over all private keys and use the content and name with

jenkins_private_key_credentials “#{filename}” do
description "#{filename} pivate key for github access"
private_key "#{content}"
end

Hoiw can i do this?

You use a databag to store the data instead of cookbook files.


Jeff Blaine
kickflop.net
PGP/GnuPG Key ID: 0x0C8EDD02