I've looked for examples of ordering with virtual resources, but I can't find any. How can I set dependencies/ordering with them? This fails the syntax check:
@file { "/usr/local/new-dir":
ensure => directory,
}
realize( File["/usr/local/new-dir"] )
->
exec { "copy old stuff to new":
command => "cp -R /usr/local/old-dir /usr/local/new-dir",
}
and testing the syntax:
$ puppet parser validate test.pp
err: Could not parse for environment production: Syntax error at '->' at /home/vagrant/test.pp:6
err: Try 'puppet help parser validate' for usage
I can think of lots of times I would want to order virtual resources, so how is it done?
You can use a collector instead of realize, and then, apply ordering:
@file { "/usr/local/new-dir":
ensure => directory,
}
exec { "copy old stuff to new":
command => "cp -R /usr/local/old-dir /usr/local/new-dir",
}
File <| title == "/usr/local/new-dir" |> -> Exec["copy old stuff to new"]