Deploy package to machine having all the specified roles


I have an environment in which i have multiple roles for machine. I want to deploy package only to those machines which have 2 roles specified in it.

Environment :: Test
Machine 1: web-app, test-app
Machine 2: web-app
Machine 3: test-app

I want to deploy my package only to Machine 1 which has 2 roles defined in it.
How can i achive this?

Thanks for your help in advance.


Hi Pratheeshnba,
Unfortunately the way in which roles are utilized during deployments is based on ‘OR’-ing those roles that are specified in the process configuration. If you specify web-app and test-app in your package deployment it will end up going to all machines with either of these roles. Paul posted a recent blog post at about exactly this topic which describes some of the logic behind this process.

Might I suggest instead that you set up Machine1 to have a new role, e.g both-apps, in addition to its existing roles (if required by some other process) and configure your deployment to look for this new role. This would then achieve your aims and makes some sense since you are effectively saying that there is some other category that a machine must have, which just happens to apply to Machine1.

Let me know what you think of this approach,

Thanks for you quick reply Robert.

I am not sure if this approach will suite us.

In our Production environment we have divided sets of machine as clusters. In each cluster there are different roles. Please see the example below.

Environment :: Production
Cluster 1 :
Machine 1 (Role :: Code-Server)
Machine 2 (Role :: DB-Server)
Machine 3 (Role :: Job-Server)

Cluster 2 :
Machine 1 (Role :: Code-Server)
Machine 2 (Role :: DB-Server)
Machine 3 (Role :: Job-Server)

Cluster 3 :
Machine 1 (Role :: Code-Server)
Machine 2 (Role :: DB-Server)
Machine 3 (Role :: Job-Server)

Like this we have several clusters.
I wanted to target servers which belongs to (cluster 1) in my intial deployment step and then after a manual intervention will deploy to other clusters.

One way to do this could be creating those many environment as many clusters we have (i.e) Procution-Cluster1, Procution-Cluster2, Procution-Cluster3 and so on.
But by this we will end up have lots of environment.
Same way we have in our integration servers also. So we will have to create those many Integration environment also.

If there was an AND condition in roles then this situation could have been handled easily without multiple environments.

Do you see any alternate approach for this scenario?

Thanks in advance.

Due to the ‘OR’ condition applied to roles your original solution using solely roles would unfortunately not work. If you only want to have cluster 1 go out first and then any and all other clusters after the manual intervention you could set up the cluster 1 role to have distinguishing roles, such as Test-Code-Server, Test-DB-Server etc. Then use these roles for your first step and non test roles for the second step, post manual intervention.

You wouldn’t need to create entirely new environments if you name the roles with enough specificity to allow the service to distinguish. Roles and scoping can get very complex very quickly, so we have so far been lead to keeping them as predictable as possible.
Let me know if this approach meets your needs.

Thanks Robert…
Will try to implement something in the same line as you suggested.