The local files
An article by Dominique, our head of technology.
Cdist is located on github.
Local files are often very useful, because it's possible to simply copy local file to a server without having the config directly in the manifest.
For example it is very simple to have the ssh-keys locally available in form of files and then manage the
Local files for each type
Each type is able to organize local files. To use local files, simply create the directory files in the type directory.
After that, the type can refer to a file in the files directory via the
__file /tmp/testfile --mode 0644 --source "$__type/files/testfile"
This would create the file
/tmp/testfile. The content of the
/tmp/testfile would be the same as in the locally available
Basically it is possible to refer to the local files with all types which use a
Besides the files which are only available for each type. It is possible to have global files directory so all types available are able to refer to files in this directory.
This may be useful if different types need to refer to the same files.
For this purpose the directory files needs to be created directly in the
dot-cdist main directory.
The reference is done with the
__file /tmp/testfile --mode 0644 --source "$__files/testfile"
Like above, this would create the file /tmp/testfile but this time fill it with the content from
Also like above xit is possible to refer to the local files with all types which use a
A type may use temporary files probably to preprocess before sending them to the remote host. The temporary directory is mostly used for templating.
For this purpose it is possible to create a temporary directory which will be removed after cdist ended.
To use a temporary files directory simply write this in your manifest:
Then it is possible to refer to files in this temporary directory.
Keep in mind that the
$__object/files differs from the
$__type/files or the