My colleague Guillaume showed me a possible implementation of the anchor
pattern:
class { c2: }
->
class { c3: }
class c1 {
notice "+++"
anchor {'before_c1':}
->
file {'/tmp/c1.txt': ensure => present }
->
anchor {'after_c1':}
}
class c2 {
include c1
notice "+++"
anchor {'before_c2':}
->
file {'/tmp/c2.txt': ensure => present }
->
anchor {'after_c2':}
}
class c3 {
notice "+++"
anchor {'before_c3':}
->
file {'/tmp/c3.txt': ensure => present }
->
anchor {'after_c3':}
}
Anchor['after_c1'] -> Anchor['before_c2']
Anchor['after_c2'] -> Anchor['before_c3']
$ puppet apply --graph test.pp
$ open -a GraphViz /Users/david/.puppet/var/state/graphs/relationships.dot
class C3 itself does not depend on class C1,
but all the resource declared in class C3 (in this case, only
/tmp/file3.txt) do depend on all the resources declared on class C2 (in
this case, only /tmp/file2.txt),
and transitively they depend also on all the resources declared on class C1
(in this case, only /tmp/file1.txt)
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/44052423-3c8c-4d2a-9cf5-4eec6a54af2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.