Search code examples
filepuppeturi-scheme

What is the `file` URI scheme in Puppet?


The documentation for the source attribute for the file resource type says:

The available URI schemes are puppet and file. puppet URIs will ...

It then explains the puppet URI scheme, but doesn't say anything about the file URI scheme. What is it? What does it mean to assign "file://foo/bar/baz" to the source attribute on a file resource?


Solution

  • The file path is always absolute. It refers to a file on the system that runs the catalog. This is the agent system, or a machine on which you invoke puppet apply.

    file {
        '/etc/motd':
            source => "file:///media/shared-storage0/motd/${fqdn}.motd";
    }
    

    For example, the above resource will make the agent sync motd contents and file metadata from a shared storage.

    You can omit the file:// and just use the full path as the source.

    source => "/media/shared-storage0/motd/${fqdn}.motd";