How to copy files to all machines using puppet master?

Puppet is a bit of a monster to get your head around, so learning by example is no bad thing. In the below I'm assuming you're using modules - please say in a comment if you're not or if you need more details about how to put the module together.

Let's say you start a new module called mymodule. In the puppet home directory (usually /etc/puppet) on the puppet master you should create the module manifests and files directory:

mkdir -p modules/mymodule/manifests
mkdir -p modules/mymodule/files

Then create a file in that directory named init.pp and enter:

class myfile {
    file { '/home/operator1/Desktop/Backup':
        ensure => directory,
        mode => '0755',
        owner => 'operator1',
        group => 'operator1',
    }

    file { "/home/operator1/Desktop/Backup/datas.xls":
        mode => "0644",
        owner => 'operator1',
        group => 'operator1',
        source => 'puppet:///modules/module_name/datas.xls',
    }
}

Then put the datas.xls file into the module's files directory - in this example in modules/mymodule/files/. (Note there can also be a templates directory for templates).

In the manifests/site.pp file you need to import the module and include the class by doing something like:

import 'mymodule'

node base {
    include myfile
}

node server1 inherits base {}
node server2 inherits base {
    # extra config here
}

Make sure that all your nodes inherit from base and that should be all you need to do. As of puppet 0.25 you can use regular expressions in the node name, eg:

node server[0-9] inherits base {}

Let me know in comments if you require further clarification.

Setting up a client to talk to the puppet master

On the client, you need to do:

sudo apt-get install puppet

Then edit /etc/default/puppet and change START=no to START=yes.

Also edit /etc/puppet/puppet.conf and add a line to the [main] section to tell it where to find the puppet master:

server=puppet.mydomain.com

Then we can do a test run with sudo puppetd --test. If you get key errors you may need to go on to the puppet master server and sign the client key. To check the exact name you can do sudo puppetca --list and then sudo puppetca --sign server1.mydomain.com (or whatever the server name was from the list command).

Now start the puppet service with sudo service puppet start and you should be away. The puppet service will run every hour, so if you update your puppet recipes then all your clients will also be updated.

Deleting Files

I note in the original question you wanted to know how to delete files. You would edit the manifests/init.pp to be

file { "/home/operator1/Desktop/Backup/datas.xls":
    ensure => absent,
}

Other useful tips

If you are having trouble there are a few things you can do. On any machine with puppet installed you can check your syntax by running

puppet --parseonly --ignoreimport myfile.pp

or check the whole lot by taking out the --ignoreimport flag, though that can lead to some funny error messages that aren't really errors I've found. You can also run puppet live on a puppet client machine by doing:

sudo puppetd --test

which shows various useful output, with errors and warnings highlighted in different colours. If you want even more detail you could run:

sudo puppetd --test --debug

but that generally generates so much output that it is hard to wade through, so only do that if you've already tried the previous steps and are stuck and need to see everything being done.

Note this is based on puppet 0.25.x which is what I use at work currently, and is also the version in Ubuntu 10.04. The puppet code in the main section will definitely still work, but later versions of puppet have new flags that can help with debugging output.