我希望能够使用 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)