Avoid declaration of if regex statements while using Exported Resources in Puppet
By making the exports unconditional, you will provoke a collision, because the manifest now declares the exported resource
Class::Define[$fqdn]
twice (with different attributes).
You can avoid this by allowing to pass the FQDN as an attribute value, instead of expecting it to be the resource title.
@@class::other_define {
"hello-$fqdn":
fqdn => $fqdn,
attribute => 'hello',
attribute2 => 'world',
tag => 'test';
"fruit-$fqdn":
fqdn => $fqdn,
attribute => 'apple',
attribute2 => 'orange',
tag => 'test2';
}
Just make sure to still use the fqdn
fact in resource titles, so that the exports from distinct agents will not collide.
As an aside, I'm not sure why you pick distinct tags, and why importing only resources that have both tags works "as expected". In fact, I'd expect that to import nothing.