If I have two class's in my own puppet module and class 'b' has a dependency on class 'a'. How can I express this in my require
statement:
# a.pp
class rehan::a {
package { 'javaruntime':
ensure => latest,
provider => chocolatey
}
}
# b.pp
class rehan::b {
file { 'C:\foo':
ensure => present,
require => Package['?????']
}
}
# site.pp
node default {
include rehan::a
include rehan::b
}
If you want to express a dependency of class b
on class a
(and also ensure that a
is in the catalog):
class rehan::b {
require rehan::a
}
If you just one resource on rehan::b to depend on class A
:
class rehan::b {
include rehan::a # ensure the class is in the catalog
file { 'C:\foo':
ensure => present,
require => Class['rehan::a'],
}
}
You can also express this relationship anywhere with Class['rehan::a'] -> Class['rehan::b']
(assuming both are included in the catalog).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With