小编cel*_*rab的帖子

如何在远程服务器中使用ansible将两个文件合并为单个文件

我需要合并两个文件,其中没有重复的条目。有什么方法可以通过 ansible 模块实现它吗?例如,我有两个文件 /etc/hosts1 和 /etc/hosts2。我需要一个 /etc/hosts 文件,其中包含 /etc/hosts1 和 /etc/hosts2 中存在的所有条目,并且没有重复的条目。我怎样才能做到这一点。举个例子将不胜感激

- name: Merge two files
  assemble:
    src: /etc/hosts1
    dest: /etc/hosts2
Run Code Online (Sandbox Code Playgroud)

上述汇编模块失败

python copy ansible ansible-playbook jinja2

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

ansible ×1

ansible-playbook ×1

copy ×1

jinja2 ×1

python ×1