I have a master node and client nodes for some application that I want to manage with Chef. They all pointing to one shared folder with configuration file that contain info about all the clients and a master. Thus, app on master node should be reloaded/rebooted each time a client app (on another client node) is installed - and its hostname added to that one shared file.
Any ideas how can I trigger restart of the Master app on Master node from a client node?
Stop using a shared file, this is a SPOF in your architecture and subject to very very very much concurrency problems.
Chef has a feature for this, it is search.
With this in mind I would do something along the line of having two recipes in your my_app cookbook, named master.rb and client.rb
In client.rb in addition to installing the client, add a tag to the node. (or use a role to define which are clients, etc)
in master.rb, repeat the search and templating:
And in the config.erb file for example:
There's some indexing delay to manage, and probably the files on each macine could be a little out of sync if the chef-run order is not carefully planned.
If you keep chef running periodically, it will converge your entire cluster within twice the run interval at maximum.