Files
ansible/windows_check-files.yml
2024-07-12 12:58:40 +02:00

69 lines
1.8 KiB
YAML

---
- name: check for movies and subs
gather_facts: no
environment:
ANSIBLE_CONFIG: config/ansible.cfg
hosts: all
become_method: runas
tasks:
# - name: find movie files above 100mb
# ansible.windows.win_find:
# paths: H:\home
# size: 524288000
# patterns: ['*.mp4', '*.mkv','*.avi', '*.MOV']
# recurse: true
# hidden: true
# follow: true
# register: movies
# - name: find subtitle files
# ansible.windows.win_find:
# paths: H:\home
# patterns: ['*.srt', '*.VTT']
# recurse: true
# hidden: true
# follow: true
# register: subs
# - name: output movie file names
# ansible.builtin.debug:
# msg: "file: {{ item }}"
# loop: "{{ movies.files | map(attribute='path') }}"
# - name: output movie subs
# ansible.builtin.debug:
# msg: "file: {{ item }}"
# loop: "{{ subs.files | map(attribute='path') }}"
- name: find all directories
ansible.windows.win_find:
paths: H:\home\yclaes
patterns: ['*']
recurse: false
file_type: directory
hidden: true
follow: true
register: directories
- name: find all recycle bin folders
ansible.windows.win_find:
paths: "{{ item }}"
patterns: ['$RECYCLE.BIN']
recurse: false
file_type: directory
hidden: true
follow: true
loop: "{{ directories.files | map(attribute='path') }}"
register: recycle_bin
# - name: output movie subs
# ansible.builtin.debug:
# msg: "{{recycle_bin}}"
- name: Get boot info after copy primary to secondary
ansible.builtin.include_role:
name: windows_find-moviesandshows
vars:
path: "{{ item | map(attribute='path') }}"
loop: "{{ recycle_bin.results}}"