- From: Joe Nuspl <
>
- To:
- Subject: [chef] Re: Re: Re: using variables in recipes?
- Date: Sun, 27 Apr 2014 20:31:06 -0700
You can also try “#{ENV[‘HOSTNAME’]}”.
Joe
On Apr 27, 2014, at 8:27 PM, Tomasz Chmielewski
<
>
wrote:
>
Unfortunately doesn't work as expected.
>
>
This is the output of $HOSTNAME on this server:
>
>
$ echo $HOSTNAME
>
server.example.com
>
>
In the recipe, "#{node['hostname']}" gives me just "server" (so, without
>
".example.com" I'm getting from $HOSTNAME variable).
>
>
"#{node['fqdn']}" gives me "localhost", and "#{node['domain']}" is empty.
>
>
>
Are there any other ways to get a variable to be used in a recipe (putting
>
aside whether the fqdn should be localhost or not)?
>
>
>
--
>
Tomasz Chmielewski
>
http://wpkg.org
>
>
>
On 2014-04-28 04:04, Wolfe, Eric G wrote:
>
> You can interpolate the ohai hostname attribute like so:
>
> "#{node['hostname']}"
>
> Tomasz Chmielewski
>
> <
>
>
> wrote:
>
> How can I use the $HOSTNAME variable in a recipe?
>
> I need something which would fit here:
>
> remote_file "/tmp/$HOSTNAME.tar.xz" do
>
> source
>
> "https://user:
:port/aaa/$HOSTNAME.tar.xz"
>
> owner "root"
>
> group "root"
>
> mode 00600
>
> not_if { ::File.exists?("/some/path/here") }
>
> end
>
> --
>
> Tomasz Chmielewski
>
> http://wpkg.org
>
Archive powered by MHonArc 2.6.16.