嗨,我想在多个文件上使用 blockinfile 函数来更改每个文件中的文本 block 。
不幸的是blockinfile不支持这个功能。有人可以帮助我吗?
最佳答案
To use blockinfile on multiple files to change blocks of text ...
您可能想要创建模板并循环 blockinfile 模块。
- blockinfile:
marker: "# {mark} ANSIBLE MANAGED BLOCK {{ item.template }}"
create: yes
path: "{{ item.file }}"
block: "{{ lookup('template', item.template) }}"
loop: "{{ files_templates }}"
关于ansible - 如何在多个文件上使用ansible blockinfile?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53380881/