Created
February 21, 2013 01:51
-
-
Save mm53bar/5001291 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Problem: how to reference templates from recipe file? | |
How about.... | |
* export all attributes as env variables (in install.sh just before the place where the role scripts get injected?) | |
* add helper method to recipes/sunzi.sh called sunzi::template | |
* call sunzi::template from recipes and pass in url of template file | |
* sunzi::template will wget the file to ~/sunzi/files/ unless the file already exists (allows override with local template file) | |
* sunzi::template will then run the template file through envsubst to substitute the env variables (http://www.oreillynet.com/linux/cmd/cmd.csp?path=e/envsubst) | |
Added bonii! | |
* removes the need to run templates through ERB | |
* Currently, you need to call recipes and pass a list of attributes as parameters. These parameters are referenced in the recipe as $1, $2, etc. If all parameters get exported at the beginning of the script, they're essentially global and don't need to be passed. Normally, global variables are bad but in this case they make it easier to use the recipes. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks good to me.
I wonder if there's a way to manage the parameters that belong to a template. It would suck if you brought in a template, but didn't have a "list" of params. Almost like a .env.example.yml but a .params.example.yml (I don't want a separate file, but more some type of "parm list builder magical thing").