Variable values across resources


#1

Hi All,
I want to use variable values across resources like below.
I wan to start windows service with service account.
can you please help me on best possible way (Chef way) to achieve this?

powershell_script 'Get-Pass' do
code <<-EOH
$secpasswd = "Some APIs to get password from central server"
EOH
action :run
end

windows_service 'service-start' do
service_name "service_name"
run_as_user "service_account"
run_as_password $secpasswd \\from above resource
action :start
end


#2

This question (or very similar) has been answered at least twice in the last 24 hours on the forum (e.g. Pass variable from powershell_script to other resources) - please remember to do a quick search before posting!

Stuart