I designed a custom cookbook for deployment of a Windows service. My goal was to use a pattern that could be used for all in-house windows services. To scale out to more services I thought we would simply create a new role for each service. This appears to be problematic and I am not sure why. When the
chef-client runs it seems to only recognize one role during convergence, and not both. I preferred one role in json format per service over a hash per service defined in an
attributes.rb file because the multiple hash attribute approach means every single service will be installed on a machine during convergence. It is more ideal to be able to apply
1 to n roles against a given machine. Team A may not need Team B’s service installed on the same instance, and vice versa. Seems like more overhead and less granularity with everything shoved into one place then looping through the objects. It also makes it more difficult for the dev teams to manager their service themselves and our team the recipe code when all of them are defined in one massive attributes file.
I have made this work for now by executing
chef-client -o role[<role_name>] to override default run list from TeamCity feeding in the role name as a parameter