popularity question answers views user  
4
Cannot get updated ipaddress for EC2 instance started after stopped

I’m developing a recipe targeting to get the update IP address for an EC2 instance as it’s just started. To achieve this, I make chef-client a system service which located under /etc/init.d/chef-client (this is default when ec2 instance is bootstrapped) and assign the run_list to the node. However, as a result I found that node[‘ipaddress’] still gets its old address rather than the new one. The reason might because chef node retrieved the value from chef server directly which still have old value. And if I run chef-client on the node again, node[‘ipaddress’] can get the updated ip value.

My question is 1. How to get updated ipaddress for the first time when the chef-client gets started as a system service. 2. If node[‘ipaddress’] get value from chef-server then how to get ip address from ohai run? I ask this because I observe that ohai always output correct value. 3. Is there any way to delay chef-client execution as a system service?

Greatly appreciate your comments!

more →
1 983  
1
How to add attributes per node?

I wan’t to setup virtual interfaces, but only on a host, so i wan’t to put somewhere something like this:

set["virtual_interfaces"] = {"eth0:1" => "80.1.2.3"}

As reading the documentation, there is no info (or i can’t find that), to do that. The first attempt, was to write

cookbooks/virtual_interfaces/attributes/my.machine-with-virtual-interfaces.com.rb

with the config, but opposite than the feel of documentation made on me… it doesn’t work.

Then i tried “knief node edit”, but i don’t want to set up each node this way, and want to save the node conf in the git chef-repo.

The other way was to use data_bags, but the problem there is… why i wan’t attributes, if i have to load it all from data_bags.

So I can’t find the way to set specific attribute to a single node.

more →
1 888  
0
How to pass attributes from knife command via ssh?

I am wondering if it is possible to pass attributes from knife command (via ssh), e.g. https://github.com/opscode/cookbooks/tree/master/java, I want to pass the node['java']['jdk'] via the command line below. Possible?

knife ssh ‘role:app-server’ ‘sudo chef-client’

more →
0 80