chef-boneyard / push-jobs-cookbook

Development repository for Chef Cookbook push-jobs
https://supermarket.chef.io/cookbooks/push-jobs
Apache License 2.0
21 stars 43 forks source link

How are you supposed to deploy in environments with windows and linux? #76

Closed spuder closed 6 years ago

spuder commented 8 years ago

For windows nodes, the cookbook requires that 2 attributes are set

node.default['push_jobs']['package_url'] = "http://www.example.com/pkgs/opscode-push-jobs-client-windows-1.1.5-1.windows.msi"
node.default['push_jobs']['package_checksum'] = "a-sha256-checksum"

The problem with this design is that most people don't have a role/environment/cookbook that is os specific. That means that linux nodes will get the same attribute as the windows nodes.

The only work around I see is to put the attributes in the "role" since those are usually platform specific. Unfortunately if you have many roles, that is a lot of repeated code.

Purposed solution

Add another level of hierarchy that allows for both windows and linux download urls.

node.default['push_jobs']['windows']['package_url'] = "....."
node.default['push_jobs']['windows']['package_checksum'] = "...."
node.default['push_jobs']['linux']['package_url'] = "....."
node.default['push_jobs']['linux']['package_checksum'] = "...."
tas50 commented 6 years ago

For the most part this should be resolved by the use of chef-ingredient, but if not you can just set those attributes in a wrapper cookbook per platform. That should get you what you're looking for. If I could write this all again I certainly would not have done it this way, but that ship has sailed.