chef-infrachef-recipeohai-gem

node attribute containing Chef server URL?


Would Chef server URL be accessible as an attribute of a node? I would like to have a custom recipe behaviour changed based on the server id (URL) the node is connected to.

https://docs.chef.io/ohai.html doesn't list server (URL) provided.

Thanks


Solution

  • The chef_server_url config setting is not available as a node attribute, but you can access this configuration via Chef::Config:

    Chef::Config['chef_server_url']