In Chef how do I detect if chef is running on a Mac? -


in cookbooks, how should check if chef recipe being provisioned onto macintosh machine?

a better solution use platform_family check. work both os x , os x server (source ohai-345).

cookbook_file "/etc/nginx/nginx.conf"   source "nginx.conf"   not_if platform_family?("mac_os_x") end 

an better solution let chef work. use single cookbook_file declaration:

cookbook_file "/etc/nginx/nginx.conf"   source "nginx.conf" end 

and ship platform specific files cookbook:

  • mycookbook/files/default/nginx.conf
  • mycookbook/files/mac_os_x/nginx.conf
  • mycookbook/files/ubuntu/nginx.conf
  • ..

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -