I am trying to set env variable within Chef recipe so that after the recipe is run, I can do echo $VAR1
bash 'set_env_var' do
code <<-EOH
echo export VAR1="https://#{node['fqdn']}" >> /etc/profile
source /etc/profile
EOH
not_if "grep -q VAR1="https://#{node['fqdn']}" >> /etc/profile"
end
Please let me know if there is a better way to do the same.