[英]Chef / kitchen - how to generate from a template locally (without creating the VM)
I have a Chef cookbook. 我有一本厨师食谱。 One of it's goals is to generate configuration file from a
.erb
template. 其目标之一是从
.erb
模板生成配置文件。 That's done as one goal in a recipe, and the template input map is filled from the node
tree. 这样做是配方中的一个目标,并且模板输入映射是从
node
树中填充的。
template node['bbcpd-bpds-api']['api_config_path'] do
source "opt/bpds-api/conf/api/bpds-api.yml.erb"
mode 0644
owner node['bbcpd-bpds-api']['user']
group node['bbcpd-bpds-api']['group']
variables(
:application_protocol => node['bbcpd-bpds-api']['application_protocol'],
:application_port => node['bbcpd-bpds-api']['application_port'],
...
I would like to generate this template locally (ie to the dir with the cookbook source) without all the other actions which prepare a virtual machine. 我想在本地生成此模板(即,生成带有食谱源的目录),而无需准备虚拟机的所有其他操作。
Basically, I would like to have something parse the files in /attributes
and prepare the node
tree and then only run the ERB templating engine, without invoking kitchen converge
. 基本上,我想在
/attributes
解析文件并准备node
树,然后仅运行ERB模板引擎,而无需调用kitchen converge
。 Or ideally, kitchen
altogether. 或理想情况下,完全是
kitchen
。 The preferred target environment is Java / JRuby / Maven. 首选的目标环境是Java / JRuby / Maven。
Is that possible? 那可能吗? Or is my best shot to separate the recipe with the template goal above and to call
kitchen converge
with only that recipe? 还是我最好的选择是将食谱与上面的模板目标分开,并且仅使该食谱称为
kitchen converge
? How to do that? 怎么做?
See Kitchen commands docs . 请参阅厨房命令文档 。
I can only see kitchen converge PLATFORM
as an option - I could add a suite. 我只能看到
kitchen converge PLATFORM
作为选项-我可以添加一个套件。 But I don't know what then. 但是我不知道那是什么。
There's also run_lists
. 还有
run_lists
。 But I don't see an explanation of what is run by what form of the runlist entry. 但是我看不到运行表条目以什么形式运行的解释。
This is not possible. 这是不可能的。 Chef only operates in the context of converging a node.
Chef仅在聚合节点的上下文中运行。 You could write your own code generator of some kind, but it would be unrelated to Chef for the most part (though you might be able to jury rig
chef-apply
into being helpful, maybe?). 你可以写某种自己的代码生成器,但它是无关的厨师大部分(虽然你也许能够陪审团钻机
chef-apply
应运而生的帮助,也许?)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.