Hello,
We have the following attribute array in Chef Automate and we're wondering how to use it correctly in code?
Here's what we have so far.
newrelic attributes:
node.default['newrelic-infra']['infra_tag'] = if node.recipes[1].include? 'domain_base'
'ips-domain-joined'
else
'non-domain-joined'
end
newrelic recipe:
template 'C:\Program Files\New Relic\newrelic-infra\newrelic-infra.yml' do
source 'newrelic-infra.yml.erb'
variables(
'license_key' => node.default['newrelic-infra']['license_key'],
'display_name' => node.default['newrelic-infra']['display_name'],
'log_file' => node.default['newrelic-infra']['log_file'],
'verbose' => node.default['newrelic-infra']['verbose'],
'proxy' => node.default['newrelic-infra']['proxy'],
'infra_tag' => node.default['newrelic-infra']['infra_tag']
)
newrelic-infra.yml.erb:
license_key: <%= @license_key %>
custom_attributes:
infra_tag: <%= @infra_tag %>
Basically, if the value of recipes[1] has 'domain_base' in it, it should set the infra_tag to 'ips-domain-joined'. Any idea what's the correct syntax to use? Gladly appreciate the help.