ansible-playbook 删除服务器上面的文件
要在服务器上删除文件,可以使用Ansible Playbook中的file模块。以下是使用file模块删除文件的示例Playbook:
---
- name: 删除文件
hosts: server
become: true
tasks:
- name: 删除文件
file:
path: /path/to/file
state: absent
在上面的Playbook中,我们指定了要删除的文件的路径,并将状态设置为“absent”。运行此Playbook将从服务器上删除指定的文件。请确保在hosts文件中指定了正确的服务器名称。
原文地址: https://www.cveoy.top/t/topic/yw3 著作权归作者所有。请勿转载和采集!