mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
windows: add #AnsibleRequires for Windows modules (#31683)
* windows: add #AnsibleRequires to set whether a module requires module or a specific version * fix up pep8 issues * changed psversion to use the actual ps Requires -Version syntax * missed the check on #Requires -Version * fix #Requires module extensions
This commit is contained in:
parent
0c34cdd0f7
commit
b004a6373a
8 changed files with 203 additions and 7 deletions
|
@ -0,0 +1,12 @@
|
|||
#!powershell
|
||||
|
||||
#Requires -Module Ansible.ModuleUtils.Legacy
|
||||
#Requires -Module Ansible.ModuleUtils.SID
|
||||
#Requires -Version 3.0
|
||||
#AnsibleRequires -OSVersion 6
|
||||
#AnsibleRequires -Become
|
||||
|
||||
$output = &whoami.exe
|
||||
$sid = Convert-ToSID -account_name $output.Trim()
|
||||
|
||||
Exit-Json -obj @{ output = $sid; changed = $false }
|
|
@ -0,0 +1,9 @@
|
|||
#!powershell
|
||||
|
||||
#Requires -Module Ansible.ModuleUtils.Legacy
|
||||
# Requires -Version 20
|
||||
# AnsibleRequires -OSVersion 20
|
||||
|
||||
# requires statement must be straight after the original # with now space, this module won't fail
|
||||
|
||||
Exit-Json -obj @{ output = "output"; changed = $false }
|
|
@ -0,0 +1,8 @@
|
|||
#!powershell
|
||||
|
||||
#Requires -Module Ansible.ModuleUtils.Legacy
|
||||
#AnsibleRequires -OSVersion 20.0
|
||||
|
||||
# this shouldn't run as no Windows OS will meet the version of 20.0
|
||||
|
||||
Exit-Json -obj @{ output = "output"; changed = $false }
|
|
@ -0,0 +1,8 @@
|
|||
#!powershell
|
||||
|
||||
#Requires -Module Ansible.ModuleUtils.Legacy
|
||||
#Requires -Version 20.0.0.0
|
||||
|
||||
# this shouldn't run as no PS Version will be at 20 in the near future
|
||||
|
||||
Exit-Json -obj @{ output = "output"; changed = $false }
|
Loading…
Add table
Add a link
Reference in a new issue