Vlad Cenan
Vlad Cenan

Reputation: 172

Automatic attribute for chef environment

I'm writing a chef recipe and I want to use the node's environment attribute. I'm not able to find something similar to automatic attributes for fqdn, hostname, or ipaddress in order to automatic discover the node environment like in the example below.

:zabbix => {
  :ipaddress   => node['ipaddress'],   # returns the IP as exected
  :environment => node['environment']  # returns nothing
}

How can I access the node's environment?

Upvotes: 1

Views: 341

Answers (1)

StephenKing
StephenKing

Reputation: 37580

You can access a node's environment through

node.chef_environment

Upvotes: 3

Related Questions