Created
March 10, 2015 16:39
-
-
Save miketheman/4bb1b16618bee1365893 to your computer and use it in GitHub Desktop.
Chef Bootstrap Partial Wrapper Example
This file contains 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
bash -x -c -e ' | |
echo $(date +%s) > /etc/created | |
apt-get update | |
' | |
<% | |
def import(fname) | |
eruby = Erubis::Eruby.new | |
here = Pathname.new(__FILE__).dirname.realpath | |
input = File.read(File.join(here, fname)) | |
src = eruby.convert(input) | |
eval src | |
end | |
-%> | |
sudo <%= import("#{Pathname.new(@config[:template_file]).dirname}/chef-full.erb") %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can replace:
with a direct path to ChefDK's installed template:
Or figure out the Ruby-specific way of inferring "where am I" from ChefDK's context and walk that path instead.
During a
knife ec2 server create
(or otherbootstrap
derivatives), provide--template-file wrapper_example.rb
to invoke this wrapper, assuming all paths are laid out correctly and files can find each other.