1) Download a file
node “UT-9c8e99e3959e”{
exec { “download”:
command => “/usr/bin/wget http://jackiechen.org -O /tmp/test_directory/jc”}
}
Example:
generic@UT-9c8e99e3959e:/tmp/test_directory$ ls
generic@UT-9c8e99e3959e:/tmp/test_directory$ sudo puppet agent –test
info: Caching catalog for ut-9c8e99e3959e
info: Applying configuration version ‘1361676600’
notice: /Stage[main]//Node[ut-9c8e99e3959e]/Exec[download]/returns: executed successfully
notice: Finished catalog run in 1.83 seconds
generic@UT-9c8e99e3959e:/tmp/test_directory$ ls
jc
2) Output to a file
node “UT-9c8e99e3959e”{
exec { “uptime”:
command => “/usr/bin/uptime >> /tmp/test_directory/uptime”}
}
Example:
generic@UT-9c8e99e3959e:/tmp/test_directory$ sudo puppet agent –test
info: Caching catalog for ut-9c8e99e3959e
info: Applying configuration version ‘1361679053’
notice: /Stage[main]//Node[ut-9c8e99e3959e]/Exec[uptime]/returns: executed successfully
notice: Finished catalog run in 0.09 seconds
generic@UT-9c8e99e3959e:/tmp/test_directory$ sudo puppet agent –test
info: Caching catalog for ut-9c8e99e3959e
info: Applying configuration version ‘1361679053’
notice: /Stage[main]//Node[ut-9c8e99e3959e]/Exec[uptime]/returns: executed successfully
notice: Finished catalog run in 0.08 seconds
generic@UT-9c8e99e3959e:/tmp/test_directory$ cat uptime
15:10:33 up 26 days, 21:33, 3 users, load average: 3.76, 3.74, 3.66
15:12:12 up 26 days, 21:35, 3 users, load average: 3.82, 3.83, 3.70