1

In /etc/puppetlabs/code/modules/send/manifests/init.pp

class send {

  file { '/tmp/hello.txt':
  owner  => 'root',
  group  => 'root',
  mode   => '0644',
  source => 'puppet://modules/send/hello.txt',
  }

}

In /etc/puppetlabs/code/modules/send/files/hello.txt

puppet agent -t reports

[root@consul-test-02 tmp]# puppet agent -t
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for consul-test-02
Info: Applying configuration version '1438919627'
Error: /Stage[main]/Send/File[/tmp/hello.txt]: Could not evaluate: Could not retrieve file metadata for puppet://modules/send/hello.txt: getaddrinfo: Name or service not known
Notice: Applied catalog in 0.03 seconds
Felix Frank
  • 8,125
  • 1
  • 23
  • 30
david
  • 39
  • 1
  • 7

1 Answers1

3

Your URL lacks on slash. Use

source => 'puppet:///modules/send/hello.txt',

Note the triple slash. Your URL had puppet://modules/... so it had a host portion of modules, which (fortunately) does not resolve to an address in your environment.

Felix Frank
  • 8,125
  • 1
  • 23
  • 30
  • Thank you. It work.But I don't understand why the triple slash. – david Aug 07 '15 at 10:07
  • The host part of the URL is supposed to remain empty, so that Puppet will automatically connect to the master that compiled the catalog. You can also insert a valid host name here if you wish, e.g. `puppet://my.puppet.server/modules/...`. – Felix Frank Aug 07 '15 at 11:43
  • I see. Thank you for help again. – david Aug 07 '15 at 12:11