I wonder to know if it is possible to install and remove packages when we change a state of node?
To clarify what I mean here is an example:
Groups:
Load balancer
Web server
Database
Nodes:
Minion1
Minion2
Minion3
If we add Minion1 to the group "Web server" then we have to install Java and Tomcat server on it. If remove Minion1 from "Web server" group then we have to remove Java and Tomcat server from it. If we add Minion 2 to both groups "Load balancer" and "Database" then we have to install Nginx and MySQL. If we remove Minion2 from the group "Database" and add Minion2 to the "Web server" then we have to remove MySQL from it and install Java and Tomcat on it. And so on..
Is it possible to configure Salt to act like this? Maybe some alternatives?