I want to manage files /home/user_name/scripts/file0
, /home/user_name/scripts/file1
, ... on my nodes, as copies of files with the same paths on the master.
Relying on /home/user_name
to be present on every node, I put this in the manifest:
file { '/home/user_name/scripts':
ensure => 'directory',
path => '/home/user_name/scripts',
recurse => true
}
That indeed gets the directory created on each of the nodes, but the contents file0
, file1
, ... are not copied.
I tried to add a source
parameter, and also recurse=>remote
, but with no further success.
Update: Trying to add the source
parameter, I added:
file { '/home/user_name/scripts':
ensure => 'directory',
path => '/home/user_name/scripts',
recurse => true,
source => '/home/user_name/scripts'
}
But with no success. Btw, here's the output when running puppet apply
Notice: Compiled catalog for puppet, master_dns in environment production in 0.64 seconds Notice: /Stage[main]/Exec_script/Exec[add_archi]/returns: executed successfully Notice: Applied catalog in 2.60 seconds
@MattSchuchard already pointed you to the relevant documentation. They explain that Puppet supports four alternatives for the form of the source
parameter, and that the form you're trying to use relies on local files as the source of the files being managed. That is, local to the node being configured.
If you want to use files residing on the master as the source, and they are not directly accessible to clients (e.g. via a network file system), then you have only two alternatives left: a URI using either the puppet:
or the http:
scheme. Unless you want to run an HTTP server on your master, only a puppet:
URI is really a viable option.
By default, however, Puppet's file server serves files only out of modules, not from arbitrary paths. And why would you want to serve arbitrary files from the master's file system? What a recipe for disaster. And why would general users need home directories on the master anyway?
The best solution would be to put the directory tree in whatever module your file
resource appears in -- say at mymodule/files/user_name/scripts. Then you could write your resource like so:
file { '/home/user_name/scripts':
ensure => 'directory',
recurse => true,
source => 'puppet://modules/mymodule/user_name/scripts'
}
But if you insist, you should be able to leave the source files where they are now, and patch it together with a symlink:
mymodule/files/user_name-scripts -> /home/user_name/scripts
... and ...
file { '/home/user_name/scripts':
ensure => 'directory',
recurse => true,
source => 'puppet://modules/mymodule/user_name-scripts',
links => 'follow'
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments