To see what Puppet code looks like, and how Puppet makes changes to a machine, we'll create a manifest file and have Puppet apply it.
Create the file site.pp
anywhere you like, with the following contents:
file { '/tmp/hello': content => "Hello, world\n", }
You can probably guess what this manifest will do, but I'll explain the code in detail first.
file { '/tmp/hello':
The word file
begins a resource declaration for a file resource. Recall that a resource is some bit of configuration that you want Puppet to manage: for example, a file, user account, or package. A resource declaration looks like this:
RESOURCE { NAME: ATTRIBUTE => VALUE, ... }
RESOURCE
indicates the type of resource you're declaring; in this case, it's a file
.
NAME
is a unique identifier that distinguishes this instance of the resource from any other that Puppet knows about. With file resources, it's usual for this to be the full path to the file, in this case, /tmp/hello
.
There follows...