1

Avoid to add a host manually as an attribute

class::define { 'title':
  attribute3 => [
    'stone',
    'wood'
  ],
  hosts         => [
    'host1.domain',
    'host2.domain'
  ]
}

class::define { 'title2':
  attribute3 => [
    'fire',
    'water'
  ],
  hosts         => [
    'host3.domaintwo',
    'host4.domaintwo'
  ]
}

by using exported resources:

if $fqdn =~ /^.*\.domain$/ {
  @@class::define { 'title':
    attribute3 => [
      'stone',
      'wood'
    ],
    hosts      => $fqdn
    tag => 'test3'
  }
}

if $fqdn =~ /^.*\.domaintwo$/ {
  @@class::define { 'title2':
    attribute3 => [
      'fire',
      'water'
    ],
    hosts      => $fqdn
    tag => 'test4'
  }
}

but this will not work

Question

How to declare exported resources as an attribute?

2
  • Sorry, still not really clear. Do you hope to export resources from two agent manifests and collect one composite resource that mixes both fqdn values in one array value for hosts? Feb 18, 2015 at 22:51
  • @FelixFrank yes. If a new host is added then this host is automatically added to the hosts array
    – 030
    Feb 18, 2015 at 22:59

0

You must log in to answer this question.

Browse other questions tagged .