如何使用Chef更改文件? [英] How can I change a file with Chef?
本文介绍了如何使用Chef更改文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有7个档案和1个战争。部署它们时,我需要更改值。我有这个:
I have 7 files and 1 war. I need to change values when I deploy them. I have this:
##usuario
#alfresco.user=*****
alfresco.user=********
##pass
#alfresco.password= sfsfs
alfresco.password=sfgsf
alfresco.rutaAnexos=/gthtfdh/dfgdf/cm:
#atributo.type.anexo=ANEXO_INFO_OBJETO
atributo.type.anexo=AN
atributo.type.observaciones=OBSERVACIONES
我需要注释一些行,并取消注释其他行。然后我需要制作七个模板,并根据环境放置变量,并在配方中创建文件。
I need to comment some lines and uncomment some other lines. Then I need to make seven templates and put variables depending on the environments and create a file in the recipe.
我该怎么做?
推荐答案
通过设计,您不会使用Chef修改文件。而是将占位符(<%= ..%>
)放入文件模板,然后将其替换为动态值(所谓的属性)。
By design, you don't modify files with Chef. Instead you put placeholders (<%= ..%>
) into the file templates, which are then replaced with the dynamic values (so called attributes).
这篇关于如何使用Chef更改文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文