O'Reilly logo

Puppet Essentials by Felix Frank

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Saving redundancy using resource defaults

The final language construct that this chapter introduces can save you quite some typing, or rather, it saves you from copying and pasting. Writing a long, repetitive manifest is not what costs you lots of time, of course. However, a briefer manifest is often more readable, and hence, more maintainable. You achieve this by defining resource defaults—attribute values that are used for resources that don't choose their own:

Mysql_grant { ensure => 'present', options => ['GRANT'], privileges => ['ALL'], tables => '*.*', } mysql_grant { 'root': user => 'root@localhost'; 'apache': user => 'apache@10.0.1.%', tables => 'application.*'; 'wordpress': user => 'wordpress@10.0.5.1', tables => 'wordpress.*'; 'backup': ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required