mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-09 14:50:02 -07:00
azure windows: changed pagefile to dynamically get the path (#35376)
This commit is contained in:
parent
b1d14d5b06
commit
ea7d29e262
4 changed files with 80 additions and 13 deletions
|
@ -77,17 +77,34 @@
|
|||
- cmdout is skipped
|
||||
- cmdout.msg is search('exists')
|
||||
|
||||
- name: get path of pagefile
|
||||
win_shell: |
|
||||
$pagefile = $null
|
||||
$cs = Get-CimInstance -ClassName Win32_ComputerSystem
|
||||
if ($cs.AutomaticManagedPagefile) {
|
||||
$pagefile = "$($env:SystemRoot.Substring(0, 1)):\pagefile.sys"
|
||||
} else {
|
||||
$pf = Get-CimInstance -ClassName Win32_PageFileSetting
|
||||
if ($pf -ne $null) {
|
||||
$pagefile = $pf[0].Name
|
||||
}
|
||||
}
|
||||
$pagefile
|
||||
register: pagefile_path
|
||||
|
||||
- name: test creates with hidden system file, should skip
|
||||
win_command: echo no
|
||||
args:
|
||||
creates: C:\pagefile.sys
|
||||
creates: '{{pagefile_path.stdout_lines[0]}}'
|
||||
register: cmdout
|
||||
when: pagefile_path.stdout_lines|count != 0
|
||||
|
||||
- name: validate result
|
||||
assert:
|
||||
that:
|
||||
- cmdout is skipped
|
||||
- cmdout.msg is search('exists')
|
||||
when: pagefile_path.stdout_lines|count != 0
|
||||
|
||||
- name: ensure testfile is still present
|
||||
win_stat:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue