27

Hi I'd like to make a puppet resource/task dependent on multiple other tasks.

For example:

file{'~/foo':}
file{'~/bar':}
file{'~/foobar':
  require => File['~foo'],
  require => File['~bar']
}

What's the correct syntax to define this?

Thanks

Keynan
  • 1,338
  • 1
  • 10
  • 18

1 Answers1

60

From Language: Data Types

Resource attributes which can optionally accept multiple values (including the relationship metaparameters) expect those values in an array.

file{'~/foo':}
file{'~/bar':}
file{'~/foobar':
  require => [ File['~foo'], File['~bar'] ]
}
Raul Andres
  • 3,766
  • 15
  • 24
  • 2
    where the resources are the same type as here you can say File[ '~foo', '~bar' ]. I found this post because I wanted to have have a resource dependent of User *and* FIle. – Russell Fulton Jun 11 '20 at 00:11