Ask Your Question

Revision history [back]

To answer your original question, every function (and file is no exception here) is evaluated on your master side, so your initial statement is not correct. Please note that the file function has nothing to do with the file resourcetype. So you can e.g. do

ssh_authorized_key { 'bob':
  ensure => present,
  user   => root,
  type   => rsa,
  key    => file('/path_to_public_keys/bob')
}

The file function will in this case read the file /path_to_public_keys/bob on your master. The filename does not appear in the compiled catalog that is handed down to your puppet agent, the property value will have already been replaced with the file's content

If you want to retrieve whole files from your master with a file resource, the file resourcetype gives you two opportunities: Specify the content directly (the whole content will be put in the catalog, just like in the example above) or just specify a link to the desired content. The catalog that needs to be handed down to your agent will be much smaller that way.

file { '/tmp/foo':
  content => file('some_file_on_your_master')
}

vs

file { '/tmp/foo':
  source => 'puppet:///modules/module_name/some_file',
}