My custom recipe runs on a certain node. During its execution, a configuration should be executed on another node.
I thought of adding an execute resource which ssh to the other node and executes the command. Not sure this is the elegant solution.
Definitely could work but as you suggested its probably not the most elegant.
Since chef is about enforcing policy on a node itself… the only way for you to accomplish that is to issue an execute command like you have really done (it wont even know if it ran properly on the other node either!) which is the downfall of execute/bash in chef.
There could be other ways to implement it with message queues and all that other jazz.
It will be hard for you to validate what happens when the execute runs too.
Just out of curiosity what is it you want to execute? does it ‘have’ to run in an order? Orchestration is definitely one of the bigger challenges with chef.
I did some googling and found Chef Push Jobs as a tool which might be helpful in my case. The issue is that I am currently using chef.io hosted chef server which doesn’t work with Chef Push Jobs.
I am using chef to deploy a client-server application on two nodes. When running the client recipe, I need to configure something on the server node. The configuration can’t be executed during the server recipe running, only during the client recipe run.