Provision in AWS - get hostname into Chef recipe

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Provision in AWS - get hostname into Chef recipe

Michael Waldrop
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.

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Provision in AWS - get hostname into Chef recipe

Mike
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

On Tue, Apr 23, 2013 at 3:45 PM, Michael Waldrop <[hidden email]> wrote:

> 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.
>
> --
> 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 [hidden email].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.