Skip to content

Instantly share code, notes, and snippets.

@ahpook
Last active December 19, 2015 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahpook/5881061 to your computer and use it in GitHub Desktop.
Save ahpook/5881061 to your computer and use it in GitHub Desktop.
Future loop
$array = [ "a", "b", "c" ]
$array.each |$x| {
$var = inline_template("instance var: <% @x %> lookupvar: <%= scope.lookupvar('x') %>")
notify { "Loop $x": message => "$var" }
}
[eric@glitch.local ~/Sandbox]% puppet apply --parser future ./future_loop.pp
Notice: instance var: lookupvar: a
Notice: /Stage[main]//Notify[Loop a]/message: defined 'message' as 'instance var: lookupvar: a'
Notice: instance var: lookupvar: b
Notice: /Stage[main]//Notify[Loop b]/message: defined 'message' as 'instance var: lookupvar: b'
Notice: instance var: lookupvar: c
Notice: /Stage[main]//Notify[Loop c]/message: defined 'message' as 'instance var: lookupvar: c'
Notice: Finished catalog run in 0.26 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment