Is there a way to implement check mode in a custom Windows module? I didn’t see anything in the documentation about it, and none of the several core modules I checked contained an example.
Thanks,
Eric
Is there a way to implement check mode in a custom Windows module? I didn’t see anything in the documentation about it, and none of the several core modules I checked contained an example.
Thanks,
Eric
There's no reason I can think of why it couldn't be done, but I don't think any core windows modules support check mode at the moment.
Might be worth a check of the extras modules if you are interested in adding support.
I don't particularly miss the lack of check mode. As I have got more familiar with powershell I do sometimes use ansible to run the raw module to check things using a powershell 1 liner. It would be good to have though. Are there specific cases where you would want to use check mode?
Jon
Yes, the Windows module API has supported check mode since 2.0. To express your module’s support for check mode, pass $true as the second arg to Parse-Args (supports_check_mode). Modules that don’t pass that will exit out with “skipped” from Parse-Args when check mode is requested.
To see if you’re actually in check mode from your module code, look for the module parameter “_ansible_check_mode” to be $true.