Update role dependencies
This commit is contained in:
@@ -16,8 +16,8 @@
|
||||
state: directory
|
||||
|
||||
- name: enable winrm
|
||||
win_shell: '& $([scriptblock]::Create((New-Object Net.WebClient).DownloadString("https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1"))) -ForceNewSSLCert -EnableCredSSP'
|
||||
ignore_errors: yes
|
||||
win_shell: '{{ enable_winrm_command }}'
|
||||
ignore_errors: true
|
||||
when: "'Windows Server 2008' in ansible_distribution or 'Windows 7' in ansible_distribution"
|
||||
|
||||
- name: copy unattend.xml
|
||||
@@ -25,9 +25,9 @@
|
||||
src: unattend.xml.j2
|
||||
dest: C:\Windows\system32\sysprep\unattend.xml
|
||||
when:
|
||||
- ('VMware' not in ansible_product_name) or ('VMware' in ansible_product_name and target_vagrant | bool)
|
||||
- ('VMware' not in (ansible_product_name | default('', true))) or ('VMware' in (ansible_product_name | default('', true)) and target_vagrant | bool)
|
||||
- not target_ovirt | bool
|
||||
- not ('KubeVirt' in ansible_system_vendor | default(''))
|
||||
- not ('KubeVirt' in ansible_system_vendor | default('', true))
|
||||
|
||||
#- name: run sysprep
|
||||
# win_shell: C:\Windows\system32\sysprep\sysprep.exe /generalize /shutdown /oobe /quiet
|
||||
@@ -40,32 +40,32 @@
|
||||
win_scheduled_task:
|
||||
name: sysprep-shutdown
|
||||
username: SYSTEM
|
||||
disallow_start_if_on_batteries: no
|
||||
stop_if_going_on_batteries: no
|
||||
disallow_start_if_on_batteries: false
|
||||
stop_if_going_on_batteries: false
|
||||
actions:
|
||||
- path: powershell.exe
|
||||
arguments: Remove-Item -Path WSMan:\localhost\Listener\* -Recurse -Force
|
||||
- path: C:\windows\system32\sysprep\sysprep.exe
|
||||
arguments: /generalize /oobe /quiet /shutdown
|
||||
when:
|
||||
- ('VMware' not in ansible_product_name) or ('VMware' in ansible_product_name and target_vagrant | bool) or (target_ovirt | bool) or ('KubeVirt' in ansible_system_vendor | default(''))
|
||||
- ('VMware' not in (ansible_product_name | default('', true))) or ('VMware' in (ansible_product_name | default('', true)) and target_vagrant | bool) or (target_ovirt | bool) or ('KubeVirt' in ansible_system_vendor | default(''))
|
||||
|
||||
- name: create scheduled task to delete WinRM listeners and shutdown
|
||||
win_scheduled_task:
|
||||
name: sysprep-shutdown
|
||||
username: SYSTEM
|
||||
disallow_start_if_on_batteries: no
|
||||
stop_if_going_on_batteries: no
|
||||
disallow_start_if_on_batteries: false
|
||||
stop_if_going_on_batteries: false
|
||||
actions:
|
||||
- path: powershell.exe
|
||||
arguments: Remove-Item -Path WSMan:\localhost\Listener\* -Recurse -Force
|
||||
- path: shutdown.exe
|
||||
arguments: /s /t 10 /f /d p:4:1 /c "Ansible Shutdown"
|
||||
when:
|
||||
- "'VMware' in ansible_product_name"
|
||||
- ('VMware' in (ansible_product_name | default('', true)))
|
||||
- not target_vagrant | bool
|
||||
- not target_ovirt | bool
|
||||
- not ('KubeVirt' in ansible_system_vendor | default(''))
|
||||
- not ('KubeVirt' in (ansible_system_vendor | default('', true)))
|
||||
|
||||
- name: set flag to recreate pagefile after next sysprep
|
||||
win_shell: |
|
||||
|
||||
Reference in New Issue
Block a user