Even though some system administrators like to wall themselves off from the rest of the office using piles of old printers, we all need to exchange information with other departments from time to time. For example, you may want to insert data into your Puppet manifests that is derived from some outside source. The generate
function is ideal for this. Functions are executed on the machine compiling the catalog (the master for centralized deployments); an example such as the one shown here will only work in a masterless configuration.
Follow these steps to prepare to run the example:
- Create the
/usr/local/bin/message.rb
script with the following contents:
#!/opt/puppetlabs/puppet/bin/ruby puts "This runs on the master if you are centralized"
- Make the script executable:
$ sudo chmod a+x /usr/local/bin/message.rb