Friday, March 1, 2013

Puppet: Override/change resource attributes defined in included class or inherited node

There can be instances where you would want to change a resource which has come from included class. If there is no way for you to *not* include, there is a way.

Resource collectors can be used to search and re-open the resource and edit it.

The code below will result in elasticsearch service as stopped in a node.
#In a node or class somewhere
service { 'elasticsearch':
  ensure => running,

#Sometime later in the code, for ex, in a node that inherits above node (also valid for classes)
Service <| title == 'elasticsearch' |> { ensure => stopped }
No multiple resource definition error or anything. :)

No comments:

Post a Comment