Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my Puppet-manifest I need to exec a command, but only after an array-driven collection of another exec finished. Like this (pseudo-code):

  define foo() {
    exec { "touch $name": }
  }

....
  {
    $bars = [ "a", "b", "c" ]
    foo { $bars : }
    exec { "echo Done" :
        require => [ Foo["a"], Foo["b"], Foo["c"] ]
    }
  }

How do I implement the same dependency as given above without repeating each element of list $bars by hand?

share|improve this question
up vote 7 down vote accepted

Ok, never mind... The same array of arguments can be used, apparently:

$bars = [ "a", "b", "c" ]
foo { $bars : }
exec { "echo Done" :
    require => [ Foo[$bars] ]
}
share|improve this answer
    
Accept your answer then :) – François Beausoleil Nov 19 '14 at 23:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.