Can someone help me with puppet node ordering, I know how to control sequence inside classes using
require, before, subscribe etc but I need to be 100% sure that my node2 will be executed only after node1 because my node2 can't work without node1.
Assuming you are using Linux hosts, but then you could also do the same with Windows host using alternative approach to bash. A somewhat generalized approach could be the following...
At the very end of puppet run for node1, create a specific file on node2. Use ssh to accomplish this as a command in a puppet resource. Ssh can be used to execute a command at a remote host to create a file--quite easy to accomplish. You would place this in an exec resource near the very end of the puppet run on node1.
Create a bash script on node 2 which basically waits for the file to show up and then returns successful when it is present. This script can be created using a file resource early in the puppet run on node2. Simple bash scripting.
Near the beginning of the puppet run for node 2, after you have created the bash script, run the very same bash script within a puppet exec resource. It will wait for the file to be created--basically waiting for the puppet run to complete on node 1 before progressing.
The steps above should provide the effect of having the puppet run on node 2 stop and wait very early in the process for the puppet run on node 1 to complete. Adjust as necessary to fit the particular host systems involved.