Knife bootstrap pass environment variable

124 Views Asked by At

I want to pass environment variables to the remote system I am bootstrapping but I am unable to do so.

Usecase: Recipes which I am using needs artifactory username and password to download the artifacts.

Example : curl -u ${ARTIFACTORY_USER}:${ARTIFACTORY_PASS} -X GET ${Artifact URL}

but I am not able to pass the values.

Knife bootstrap command which I am using is

knife bootstrap ${IPAddress} -o winrm -x ${username} -P ${password} -N ${Chef_Node} --policy-group ${Policy_Group_Name} --policy-name ${PolicyFile_Name}

I tried sending the variable in knife.rb and config.rb file in the below format but didn't work.

knife[:ARTIFACTORY_USER] = ENV['ARTIFACTORY_USER']
knife[:ARTIFACTORY_PASS] = ENV['ARTIFACTORY_PASS']
0

There are 0 best solutions below