win_feature: Clean up and check-mode support (#21351)

* Clean up parameter handling and added check-mode support

Changes include:
- Remove trailing semi-colons
- Replaced PSObjects into normal hashes
- Make use of Get-AnsibleParam and types
- Added check-mode support

* Implemented -WhatIf:$check_mode support

* powershell.ps1: Ensure Fail-Json() works with Hashtables

Without this change a dictionary $result object would be emptied if it
is anything but a PSCustomObject. Now we also support Hashtables.

* Revert to original formatting
This commit is contained in:
Dag Wieers
2017-03-15 03:01:03 +01:00
committed by Matt Davis
parent 589c483cfc
commit 9755d2dbbc
2 changed files with 46 additions and 57 deletions

View File

@@ -38,11 +38,9 @@ options:
description:
- Names of roles or features to install as a single feature or a comma-separated list of features
required: true
default: null
state:
description:
- State of the features or roles on the system
required: false
choices:
- present
- absent
@@ -53,16 +51,12 @@ options:
choices:
- yes
- no
default: null
required: false
include_sub_features:
description:
- Adds all subfeatures of the specified feature
choices:
- yes
- no
default: null
required: false
include_management_tools:
description:
- Adds the corresponding management tools to the specified feature.
@@ -70,13 +64,10 @@ options:
choices:
- yes
- no
default: null
required: false
source:
description:
- Specify a source to install the feature from.
- Not supported in Windows 2008. If present when using Windows 2008 this option will be ignored.
required: false
choices: [ ' {driveletter}:\sources\sxs', ' {IP}\Share\sources\sxs' ]
version_added: "2.1"
author: