Modify your
manifests/nodes.pp
file as follows:node 'demo' { exec { 'Run my arbitrary command': command => '/bin/echo I ran this command on `/bin/date` >/tmp/command.output.txt', } }
Run Puppet:
ubuntu@demo:~/puppet$ papply Notice: /Stage[main]//Node[demo]/Exec[Run my arbitrary command]/returns: executed successfully Notice: Finished catalog run in 0.14 seconds
Check the output produced (you won't see exactly the same date and time shown here, unless you're a Time Lord):
ubuntu@demo:~/puppet$ cat /tmp/command.output.txt I ran this command on Mon Dec 17 16:14:04 UTC 2012
The line exec { 'Run my arbitrary command':
declares an exec
resource with the name Run my arbitrary command
. The name can be anything; it's not otherwise used by Puppet, except that like all resource names it can't be the same as another instance of the same resource type.
The command to run is specified by the following line:
command => '/bin...