The method described is a valid one but not the easiest to maintain.The values you're looking for can be obtained from the Chef::Config hash i.e.:chef > Chef::Config[:chef_server_url]chef >Note that the information is not available in the format exactly you're asking for. Another thing is you have a bit of a chicken and egg problem. How are you able to run chef connected to the server if you don't have the DNS entry already? Is this just a failback for flakey DNS?On Wed, May 29, 2013 at 7:39 AM, Vladimir Skubriev < " target="_blank"> > wrote:
This is not true way. I think this vars must be present by default in chef runtime.On 29.05.2013 15:37, Mukta Aphale wrote:
One way is to set the values in your client node.Do a knife node edit and add the values chefserverip and chefserverhostname.These will be accessible to all recipes.
You can also set recipe specific attributes.
On Wed, May 29, 2013 at 4:18 PM, Vladimir Skubriev < " target="_blank"> > wrote:
Where i can find chef server ip and hostname in a recipe for add variable to template
For example i have a recipe:
# Creating true /etc/hosts
template "/etc/hosts" do
mode 0644
owner "root"
group "root"
source "etc/hosts.erb"
variables ({
:ip => node[:dc][:ip],
:domain => node[:dns][:domain],
:hostname => node[:dc][:hostname],
:chefserverip => ???????????????,
:chefserverhostname => ???????????????
})
action :create
end
and template:
127.0.0.1 localhost
<%= @chefserverip %> <%= @chefserverhostname %>.<%= @domain %>
<%= @ip %> <%= @hostname %>.<%= @domain %> <%= @hostname %>
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
How I can access service variables ??????????????? and ???????????????
And for a future:
How can i know what service vars are present when recipes are run? My be present a simple method or you hac a true doc url ?
Thank you very much.
-- Best regards, CVision Lab System Administrator Vladmir Skubriev
Set vars in node, environment, data bag, etc - is not true.
-- Best regards, CVision Lab System Administrator Vladmir Skubriev
Archive powered by MHonArc 2.6.16.