Re: [Puppet Users] DRY duplicated manifest code

2016-03-23 Thread Henrik Lindberg
On 23/03/16 21:04, Hunter Haugen wrote: Given the resource you want to apply this pattern to, it can be turned into a one-liner with a collector: file { '/tmp/something': ensure => file, } File['/tmp/something'] ~> Service <| title == 'apache2' |> This means that if there is a service with a

Re: [Puppet Users] DRY duplicated manifest code

2016-03-23 Thread Henrik Lindberg
On 23/03/16 21:56, Matt Zagrabelny wrote: On Wed, Mar 23, 2016 at 3:04 PM, Hunter Haugen wrote: Given the resource you want to apply this pattern to, it can be turned into a one-liner with a collector: file { '/tmp/something': ensure => file, } File['/tmp/something'] ~> Service <| title ==

Re: [Puppet Users] DRY duplicated manifest code

2016-03-23 Thread Matt Zagrabelny
On Wed, Mar 23, 2016 at 3:04 PM, Hunter Haugen wrote: > Given the resource you want to apply this pattern to, it can be turned into > a one-liner with a collector: > > file { '/tmp/something': > ensure => file, > } > File['/tmp/something'] ~> Service <| title == 'apache2' |> Can you combine the

Re: [Puppet Users] DRY duplicated manifest code

2016-03-23 Thread Matt Zagrabelny
On Wed, Mar 23, 2016 at 3:04 PM, Hunter Haugen wrote: > Given the resource you want to apply this pattern to, it can be turned into > a one-liner with a collector: > > file { '/tmp/something': > ensure => file, > } > File['/tmp/something'] ~> Service <| title == 'apache2' |> > > This means that

Re: [Puppet Users] DRY duplicated manifest code

2016-03-23 Thread Hunter Haugen
Given the resource you want to apply this pattern to, it can be turned into a one-liner with a collector: file { '/tmp/something': ensure => file, } File['/tmp/something'] ~> Service <| title == 'apache2' |> This means that if there is a service with a title of apache2 EVER added to the catalog

[Puppet Users] DRY duplicated manifest code

2016-03-23 Thread Matt Zagrabelny
Greetings Puppet Users, I have a chuck of code I'd like to centralize - you know DRY. I've looked into a custom function, but I'm uncertain how to get at the the puppet resources inside of ruby. Here is the verbatim copy of the chuck in a puppet manifest: if defined(Service['apache2']) { $s