小编Cha*_*pop的帖子

使用 Ansible 替换文件的全部内容

我希望能够使用 Ansible playbook 替换文件的全部内容。

我已经编写了那段代码,但似乎使用通配符是错误的方法。

---
  - hosts: my_hosts
    tasks:
     - name: Replace the content of my file
       lineinfile:
         path: /home/user-ansible/test/conf
         regexp: "*"
         line: "{{ lookup('file', '/home/ansible/config/conf') }}"
Run Code Online (Sandbox Code Playgroud)

scripting yaml ansible

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

标签 统计

ansible ×1

scripting ×1

yaml ×1