Skip to content

informatique-cdc/ansible-role-win_directory_empty

Repository files navigation

win_directory_empty - Ensure that a folder is empty

Synopsis

  • This Ansible module ensures that a or more folders are empty.

Parameters

Parameter Choices/Defaults Comments
path
string / required
A path to one or more locations of the items being removed.
exclude
string
An item or items that this module excludes in the operation.

Examples

---
- name: test the win_directory_empty module
  hosts: all
  gather_facts: false

  roles:
    - win_directory_empty

  tasks:

    - name: Ensure the temp folder is empty
      win_directory_empty:
        path: 'c:\windows\temp'

    - name: Ensure the temp folder is empty
      win_directory_empty:
        path:
          - 'c:\windows\temp'
          - 'c:\temp'
        exclude: '*1*'

    - name: Ensure the temp folder is empty
      win_directory_empty:
        path:
          - 'c:\windows\temp'
          - 'c:\temp'
        exclude:
          - 'vmware-*.log'
          - '*2*'

Authors

  • Stéphane Bilqué (@sbilque) Informatique CDC

License

This project is licensed under the Apache 2.0 License.

See LICENSE to see the full text.