aws opsworks - Chef Best Practice Loop same recipe -


can suggest in chef best way handle looping , running recipe. example have in recipe

apps_databag = search("aws_opsworks_app")  apps_databag.each |app_settings|  case app_settings['app_source']['type']   when 's3'    include_recipe 'recipe'   when 'git'    include_recipe 'recipe2'   else    chef::log.warn("*** warning!! cannot find app deployment type. please check app .. aborting ***") end 

background.. in 1 stack have many app deployed in different server layers. did because cannot share rds in 2 different stack. it's working , when loop app have trick run recipe according it's type unfortunately include_recipe not choice , sake of recipe don't want make recipe bloody maintain injecting more lines

any suggestion scenario?

if have multiples apps of each type deploy on same machine, move recipe custom resource/lwrp.

a recipe can included once, loops won't multiples apps of same type.

then you'll replace our include_recipe calls resource definitions in case statement.

without more details on in recipe, can't give more advice on it.


Comments