Added new module win_disk_facts (#32935)

* Added module new win_disk_facts

* Corrected examples section

* Added integration tests

* Added some disk properties

* Removed whitspaces

* Extended docu

* Changed header

* Added partition, volume and physical disk output

* Removed MediaType property of phys. disk

* Added return values

Added virtual disk, volume and physical disk output

* Added docu for return values

* Removed whitespaces

* Improved and added values

- Added virtual disk return values
- Improved code

* Updated docu

* Removed whitespaces

* Removed check

* Improved code and docu

* Changed integration test

* Changed integration test

* Changed integration test

* Changed integration test

* corrected typo

* Added admin test because CIM is not available with user rights

* Changed unit prefix from decimal to binary
This commit is contained in:
Marc Tschapek 2017-12-20 12:53:19 +01:00 committed by Jordan Borean
commit b3ff93e129
5 changed files with 813 additions and 0 deletions

View file

@ -0,0 +1,13 @@
# NOTE: The win_disk_facts module only works on Win2012R2+
- name: check whether storage module is available (windows 2008 r2 or later)
raw: PowerShell -Command Import-Module Storage
register: win_feature_has_storage_module
ignore_errors: true
- name: Only run tests when Windows is capable
when: (win_feature_has_storage_module|success) and (ansible_powershell_version is defined) and (ansible_powershell_version >= 3)
block:
- name: Test in normal mode
include: tests.yml

View file

@ -0,0 +1,17 @@
- name: get disk facts on the target
win_disk_facts:
register: disks_found
- name: assert disk facts
assert:
that:
- disks_found.changed == false
- disks_found.ansible_facts.disks[0].size is defined
- disks_found.ansible_facts.disks[0].number is defined
- disks_found.ansible_facts.disks[0].operational_status is defined
- disks_found.ansible_facts.disks[0].read_only is defined
- disks_found.ansible_facts.disks[0].clustered is defined
- disks_found.ansible_facts.disks[0].location is defined
- disks_found.ansible_facts.disks[0].guid is defined
- disks_found.ansible_facts.disks[0].path is defined
- disks_found.ansible_facts.disks[0].bootable is defined