0
votes

I'm setting up chef with vagrant and having trouble getting the current node name for use in configuration.

My vagrant config has:

  config.vm.provision "chef_client" do |chef|
    chef.node_name = 'test123'
  end

And my chef environment has:

override_attributes["app1"] = {
    "domain" => "ma-#{Chef::Config[:node_name]}.app1.local"
}

However I don't get the correct value for node_name as set in the VagrantFile. How can I access the chef node name within my environment file?

Or, alternatively, how can I override the "domain" attribute directly from my VagrantFile?

1

1 Answers

0
votes

You want

node.name

See also:

node['fqdn']
node['hostname']