First I create a define
that can, say, create an nginx config file
define nginx::config ($var1, var2) {
file {
"/etc/nginx/conf.d/${var1}.conf":
ensure => present,
content => template('nginx/template.erb'),
notify => Service['nginx'];
}
}
Next I define node_a
which will "export" one nginx::config
node 'node_a' {
@@nginx:config {
'config_for_something':
tag => 'a_tag',
var1 => 'foo',
var2 => 'bar'
}
}
Then I gather these defines on node_b
node 'node_b' {
Nginx::Config <<| tag == 'a_tag' |>>
}
This will create the file on node_b
but in the scope of node_b
(so all other variables need to be sent from node_a
)