티스토리 뷰

Samples

- name: Find files to delete
  find:
    paths: /home/mcpaint/backup
    patterns: *.tar.gz
  register: out
  
- name: Delete files to delete
  file:
    path: "{{ item.path }}"
    state: absent
  with_items: "{{ out.files }}"
  loop_control:
    label: "{{ item.path }}"

 

Documents

https://docs.ansible.com/ansible/latest/collections/ansible/builtin/find_module.html

 

참고 자료: http://www.freekb.net/Article?id=573 

 

Remove files and directories using the file module

Add a Comment Comments

www.freekb.net

 

 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함