You want to use code from the puppet stdlib
First install stdlib from the Puppet Forge:
# install the stdlib module
$ sudo /opt/puppetlabs/bin/puppet module install puppetlabs-stdlib
...
Notice: Installing -- do not interrupt ...
/etc/puppetlabs/code/environments/production/site
puppetlabs-stdlib (v4.12.9)
...
Then use code from it in your puppet manifests:
class strace {
notify { 'In strace': }
ensure_packages(['strace'], { ensure => 'present' })
}
class debug_tools {
# install lots of debug tools, and then strace
notify { 'In debug_tools': }
ensure_packages(['strace'], { ensure => 'present' })
}
include strace
include debug_tools
The Puppetlabs stdlib module is a collection of puppet enhancements that provide commonly requested functionality. Some are basic additions, missing from the core, and others are version compatibility shims that can make maintaining code across multiple puppet versions easier.
While it's possible to maintain a large puppet code base without using stdlib
, a
large number of modules on the Puppet Forge rely on its functionality. It can
often save you writing your own little utility functions while also providing
some helpful examples of the what and how of extending puppet with functions.