Provision in AWS - get hostname into Chef recipe

596 views
Skip to first unread message

Michael Waldrop

unread,
Apr 23, 2013, 3:45:48 PM4/23/13
to vagra...@googlegroups.com
I'm doing a very simple Vagrant provisioning to a single AWS server node.  I got all the AWS provisioning to work perfectly.  Now I'm trying to figure out the easiest way to set a chef recipe value to the public hostname of the new EC2 instance.  I can easily make a script curl call to get the public hostname of the new image, but I'm not sure the right way to capture the results of that command and make it an attribute I can use in my chef script.

Can I do something like chef.json = { :hostname => 'curl -s http://169.254.169.254/latest/meta-data/public-hostname' } ?  I've tried several variations of this idea with no luck yet.

Mike

unread,
Apr 23, 2013, 3:47:17 PM4/23/13
to vagra...@googlegroups.com
Consider:

node['ec2']['public_hostname']

In general, if you run `ohai ec2` on the instance, you can see all the
attributes it will know about and be available to Chef.

-M
> --
> You received this message because you are subscribed to the Google Groups
> "Vagrant" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to vagrant-up+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages