Update roles

This commit is contained in:
2021-06-29 22:10:31 -04:00
parent dfe9dea2ca
commit caf10019e2
45 changed files with 156 additions and 739 deletions

View File

@@ -47,7 +47,7 @@ Including an example of how to use your role (for instance, with variables passe
export_ovf: no # export the template to export domain upon creation
local_account_password: ''
local_administrator_password: ''
windows_distro_name: 2019_standard # this needs to be one of the standard values see 'os_short_names' var
distro_name: win2019 # this needs to be one of the standard values see 'os_short_names' var
template_vm_name: win2019_template
template_vm_root_disk_size: 30
template_vm_guest_id: windows_2019x64

View File

@@ -19,8 +19,8 @@ custom_efi_enabled: no
custom_efi_path: /usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd
qemu_second_cdrom_device_bus_type: ide
qemu_second_cdrom_device_bus_id: 3
qemu_second_cdrom_device_bus_unit: 0
qemu_second_cdrom_device_bus_id: 3 # tested with Q35 chipset, if using I440FX chipset, try setting this to 1
qemu_second_cdrom_device_bus_unit: 0 # tested with Q35 chipset, if using I440FX chipset, try setting this to 1
virtio_iso_url: https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.173-2/virtio-win.iso
winrm_enable_script_url: https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1
@@ -33,7 +33,7 @@ local_administrator_password: Chang3MyP@ssw0rd21
local_account_username: ansible
local_account_password: Chang3MyP@ssw0rd21
windows_distro_name: 2019_standard_core
distro_name: win2019
iso_file_name: 17763.253.190108-0006.rs5_release_svc_refresh_SERVER_EVAL_x64FRE_en-us.iso
windows_sysprep_template_folder: windows_server
@@ -69,10 +69,8 @@ ovirt_export_domain: export_domain
ovirt_iso_domain: iso_domain
os_short_names:
2008_r2_standard: 2k8R2
2012_r2_standard: 2k12R2
2012_r2_datacenter: 2k12R2
2016_standard: 2k16
2016_standard_core: 2k16
2019_standard: 2k19
2019_standard_core: 2k19
win2008: 2k8R2
win2012: 2k12R2
win2016: 2k16
win2019: 2k19
win10: 10

View File

@@ -1,2 +1,2 @@
install_date: Wed May 5 16:14:00 2021
install_date: Wed Jun 30 01:12:45 2021
version: ''

View File

@@ -2,7 +2,7 @@
- name: validate file
stat:
path: "{{ playbook_dir }}/{{ temp_directory }}/windows_{{ windows_distro_name }}_autounattend_autogen.iso"
path: "{{ playbook_dir }}/{{ temp_directory }}/windows_{{ distro_name }}_autounattend_autogen.iso"
get_checksum: no
register: iso_file_check

View File

@@ -23,7 +23,7 @@
include_tasks: virtio_drivers.yml
- name: create iso
command: mkisofs -V ADDISO -r -iso-level 4 -o {{ playbook_dir }}/{{ temp_directory }}/windows_{{ windows_distro_name }}_autounattend_autogen.iso .
command: mkisofs -V ADDISO -r -iso-level 4 -o {{ playbook_dir }}/{{ temp_directory }}/windows_{{ distro_name }}_autounattend_autogen.iso .
args:
chdir: "{{ playbook_dir }}/{{ temp_directory }}/ks_iso"
@@ -34,6 +34,6 @@
path: "{{ temp_directory }}/{{ item }}"
state: absent
loop:
- windows_{{ windows_distro_name }}_autounattend_autogen.iso
- windows_{{ distro_name }}_autounattend_autogen.iso
- virtio_win.iso
- ks_iso/

View File

@@ -12,8 +12,8 @@
- name: set list of directories to copy
set_fact:
virtio_iso_list_of_directories_to_extract:
- /viostor/{{ os_short_names[windows_distro_name] | default('2k16') }}/amd64
- /NetKVM/{{ os_short_names[windows_distro_name] | default('2k16') }}/amd64
- /viostor/{{ os_short_names[distro_name] | default('2k16') }}/amd64
- /NetKVM/{{ os_short_names[distro_name] | default('2k16') }}/amd64
- name: get a list of files from template iso
shell: >

View File

@@ -34,7 +34,7 @@
</ModifyPartition>
<ModifyPartition wcm:action="modify">
<Format>NTFS</Format>
<Label>{{ windows_distro_name[0:31] }}</Label>
<Label>{{ distro_name[0:31] }}</Label>
<Letter>C</Letter>
<Order>2</Order>
<PartitionID>2</PartitionID>
@@ -78,7 +78,7 @@
<Letter>C</Letter>
<Order>4</Order>
<PartitionID>4</PartitionID>
<Label>{{ windows_distro_name[0:31] }}</Label>
<Label>{{ distro_name[0:31] }}</Label>
</ModifyPartition>
</ModifyPartitions>
<DiskID>0</DiskID>
@@ -158,7 +158,7 @@
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<OOBE>
<HideEULAPage>true</HideEULAPage>
{% if not '2008' in windows_distro_name %}
{% if not '2008' in distro_name %}
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
<HideLocalAccountScreen>true</HideLocalAccountScreen>
@@ -219,7 +219,7 @@
<Order>1</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
{% if not '2008' in windows_distro_name %}
{% if not '2008' in distro_name %}
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c powershell -Command "Set-NetConnectionProfile -NetworkCategory Private"</CommandLine>
<Description>Set network connection profile to private</Description>
@@ -305,8 +305,32 @@
<Order>15</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c dism /online /enable-feature /featurename:NetFx2-ServerCore</CommandLine>
<Description>Enable NetFx2-ServerCore feature</Description>
<Order>16</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c dism /online /enable-feature /featurename:NetFx2-ServerCore-WOW64</CommandLine>
<Description>Enable NetFx2-ServerCore feature</Description>
<Order>17</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c dism /online /enable-feature /featurename:MicrosoftWindowsPowerShell</CommandLine>
<Description>Enable MicrosoftWindowsPowerShell feature</Description>
<Order>18</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c dism /online /enable-feature /featurename:ServerManager-PSH-Cmdlets</CommandLine>
<Description>Enable ServerManager-PSH-Cmdlets feature</Description>
<Order>19</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
{% endif %}
{% if '2016' in windows_distro_name %}
{% if '2016' in distro_name %}
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c reg add HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 /v SchUseStrongCrypto /t REG_DWORD /d 1 /reg:64 /f</CommandLine>
<Description>Configure security protocol</Description>
@@ -333,7 +357,7 @@
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
{% if template.networks is defined and template.networks[0].ip is defined and template.networks[0].gateway is defined and template.networks[0].netmask is defined %}
{% if not '2008' in windows_distro_name %}
{% if not '2008' in distro_name %}
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c powershell -Command "New-NetIPAddress IPAddress {{ template.networks[0].ip }} -DefaultGateway {{ template.networks[0].gateway }} -PrefixLength {{ (template.networks[0].ip + '/' + template.networks[0].netmask) | ipaddr('prefix') }} -InterfaceIndex (Get-NetAdapter).InterfaceIndex"</CommandLine>
<Description>Set static ip</Description>
@@ -349,7 +373,7 @@
</SynchronousCommand>
{% endif %}
{% if template.networks[0].dns_servers is defined %}
{% if not '2008' in windows_distro_name %}
{% if not '2008' in distro_name %}
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c powershell -Command "Set-DNSClientServerAddress InterfaceIndex (Get-NetAdapter).InterfaceIndex ServerAddresses {{ template.networks[0].dns_servers|join(',') }}"</CommandLine>
<Description>Set static ip</Description>

View File

@@ -2,7 +2,7 @@
temp_directory: tmp{{ awx_job_id | default('') }}
iso_file: "windows_{{ windows_distro_name }}_autounattend{{ awx_job_id | default('') }}.iso"
iso_file: "windows_{{ distro_name }}_autounattend{{ awx_job_id | default('') }}.iso"
export_dir: "{{ playbook_dir }}/{{ temp_directory }}"