Skip to content

Instantly share code, notes, and snippets.

@codec
Last active December 24, 2015 09:59
Show Gist options
  • Save codec/6781294 to your computer and use it in GitHub Desktop.
Save codec/6781294 to your computer and use it in GitHub Desktop.
define foo ($primary_interface='eth0') {
notify { "foo $name local-scope":
message => $primary_interface
} ->
notify { "foo $name top-scope":
message => $::primary_interface
}
}
class bar ($primary_interface='eth1') {
notify { "bar local-scope":
message => $primary_interface
} ->
notify { "bar top-scope":
message => $::primary_interface
}
}
foo { 'test1': } ->
foo { 'test2': primary_interface => 'eth1' } ->
class { 'bar': }
Notice: Compiled catalog for puppet.localdomain in environment production in 0.07 seconds
Notice: eth0
Notice: /Stage[main]//Foo[test1]/Notify[foo test1 local-scope]/message: defined 'message' as 'eth0'
Notice: eth0
Notice: /Stage[main]//Foo[test1]/Notify[foo test1 top-scope]/message: defined 'message' as 'eth0'
Notice: eth1
Notice: /Stage[main]//Foo[test2]/Notify[foo test2 local-scope]/message: defined 'message' as 'eth1'
Notice: eth0
Notice: /Stage[main]//Foo[test2]/Notify[foo test2 top-scope]/message: defined 'message' as 'eth0'
Notice: eth1
Notice: /Stage[main]/Bar/Notify[bar local-scope]/message: defined 'message' as 'eth1'
Notice: eth0
Notice: /Stage[main]/Bar/Notify[bar top-scope]/message: defined 'message' as 'eth0'
Notice: Finished catalog run in 0.09 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment