ruby - How does Chef include files generated on runtime as a template source -
using chef recipe, first generating .erb file dynamically based on inputs csv file , want use .erb file template source. unfortunately changes made (in .erb file) not considered while recipe converging resources. tried use lazy evaluation not able figure out how use template source.
quoting template documentation:
sourceruby types: string, arraythe location of template file. default, chef-client looks template file in /templates directory of cookbook. when local property set true, use specify path template on local node. property may used distribute specific files specific platforms. see “file specificity” below more information. default value: name of resource block. see “syntax” section above more information.)
and
localruby types: trueclass, falseclass
load template local path. default, chef-client loads templates cookbook’s /templates directory. when property set true, use source property specify path template on local node. default value: false.
so can is:
# generate local .erb file let's source.erb template "/path/to/file" source "/path/to/source.erb" local true end your question sounds , xy problem, reading csv file make template sounds counter-productive , done attributes , taking advantage of variable attribute of template resource.
Comments
Post a Comment