Ask Your Question

Variable not expanding in file resource source

asked 2014-12-31 08:46:45 -0600

david.arnold gravatar image

updated 2014-12-31 16:12:57 -0600

GregLarkin gravatar image

Hi all,

I receive this error from the following file resource. Can anyone help me out with what is going wrong?

Error: /Stage[main]/Puppetagent/File[/etc/puppet/puppet.conf]: Could not evaluate: Could not retrieve information from environment infrastructure source(s) puppet:///modules/puppetagent/puppet.$::{hostname}.conf

  file { '/etc/puppet/puppet.conf':
    ensure  => file,
    path    => '/etc/puppet/puppet.conf',
    owner   => 'puppet',
    group   => 'puppet',
    mode    => '0644',
    require => Package['puppet'],
    source  => "puppet:///modules/puppetagent/puppet.$::{hostname}.conf",
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-12-31 16:14:25 -0600

GregLarkin gravatar image

Switch your variable syntax to ${::hostname} and you should be all set.

edit flag offensive delete link more


Worked perfectly. Thank you.

david.arnold gravatar imagedavid.arnold ( 2015-01-02 06:19:41 -0600 )edit

Good to hear it - you're welcome!

GregLarkin gravatar imageGregLarkin ( 2015-01-02 15:01:50 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-12-31 08:46:45 -0600

Seen: 485 times

Last updated: Dec 31 '14