chef-gen-flavors Chef Tool
A framework for distributing "flavors" of ChefDK generator templates as ruby gems.
Install & Usage Instructions
chef-gen-flavors is a framework for creating custom templates for the
'chef generate' command provided by ChefDK.
This gem simply provides a framework; templates are provided by separate
gems, which you can host privately for use within your organization or
publicly for the Chef community to use.
At present this is focused primarily on providing templates for generation of
cookbooks, as this is where most organization-specific customization takes place.
Support for the other artifacts that ChefDK can generate may work, but is not
the focus of early releases.
chef gem install chef-gen-flavors
You will also need to install at least one plugin, which may be distributed
via Rubygems (in which case you install using
chef gem) or as source, in
which case you should refer to the installation documentation that comes with
knife.rb file, add this snippet:
# only load ChefGen::Flavors if we're being called from the ChefDK CLI if defined?(ChefDK::CLI) require 'chef_gen/flavors' chefdk.generator_cookbook = ChefGen::Flavors.path end
When you run
chef generate, all available plugins will be loaded. If more
than one plugin is found, you will be prompted as to which you want to use:
$ chef generate cookbook my_app
If you set the environment variable
CHEFGEN_TEMPLATE to the name of a
plugin, it will be chosen instead of presenting a prompt:
$ CHEFGEN_TEMPLATE=mytemplate chef generate cookbook my_app