Hi I'm new to puppet and trying to work on a sample to copy files from one location to another location. Any sample script to do that?
Ex: I've my file at d:\temp\test.txt and I want to copy this file to E:\mycopy\ folder.
The init. pp manifest is the main class of a module and, unlike other classes or defined types, it is referred to only by the name of the module itself. For example, the class in init. pp in the puppetlabs-motd module is the mot d class.
A Puppetfile specifies detailed information about each environment's Puppet code and data, including where to get the code and data from, where to install it, and what version of it to install.
You can "ensure" that the file at target location exists and provide the file to be copied as source in file type. A partial code snippet only showing relevant parts:
file { 'E:\mycopy\folder\filename':
ensure => present,
source => "d:\temp\test.txt",
}
Check the documentation of file type here and how source attribute behaves here. Now this will work with a few caveats :
But what is your exact purpose? Similar thing can be achieved with content
attribute of file type or other attributes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With