This commit is contained in:
2020-08-17 12:06:41 -04:00
parent 9fa09f26bd
commit 6eb48873e6
455 changed files with 45184 additions and 14 deletions

View File

@@ -0,0 +1,23 @@
---
- name: Download {{ virtio_win_iso_name }}
win_get_url:
url: '{{ virtio_win_iso_url }}'
force: false
dest: '{{ ansible_env.TEMP }}\{{ virtio_win_iso_name }}'
notify:
- Delete downloaded
- name: Mount {{ virtio_win_iso_name }}
win_disk_image:
image_path: '{{ ansible_env.TEMP }}\{{ virtio_win_iso_name }}'
register: win_disk_image
until: win_disk_image is success
delay: 3
retries: 5
notify:
- Unmount
when: ('Windows Server 2008' not in ansible_distribution)
- include_tasks: extract_iso.yml
when: ('Windows Server 2008' in ansible_distribution)

View File

@@ -0,0 +1,20 @@
---
- name: Install 7-zip
win_chocolatey:
name: 7zip
state: present
- name: Ensure temp directory exists for iso
win_file:
path: '{{ ansible_env.TEMP }}\virtio_iso_extract'
state: directory
- name: Extract iso
win_shell: >
7z.exe x -y '{{ ansible_env.TEMP }}\{{ virtio_win_iso_name }}' -o'{{ ansible_env.TEMP }}\virtio_iso_extract'
- name: Remove 7-zip
win_chocolatey:
name: 7zip
state: absent

View File

@@ -0,0 +1,33 @@
---
- name: Set the virtio_win_iso_path and virtio_win_virtio_path
set_fact:
virtio_win_iso_path: '{{ win_disk_image.mount_path | default(virtio_iso_mount_drive) }}'
virtio_win_virtio_path: "{{ (win_disk_image.mount_path | default(virtio_iso_mount_drive)) + '\\virtio' if virtio_win_ovirt else (win_disk_image.mount_path | default(virtio_iso_mount_drive)) }}"
virtio_win_iso_name: "{{ virtio_win_iso_name }}"
when:
- virtio_iso_mount_drive | length > 0 or ('Windows Server 2008' not in ansible_distribution)
- name: Set the virtio_win_iso_path and virtio_win_virtio_path
set_fact:
virtio_win_iso_path: '{{ ansible_env.TEMP }}\virtio_iso_extract'
virtio_win_virtio_path: "{{ ansible_env.TEMP + '\\virtio_iso_extract\\virtio' if virtio_win_ovirt else ansible_env.TEMP + '\\virtio_iso_extract' }}"
virtio_win_iso_name: "{{ virtio_win_iso_name }}"
when:
- virtio_iso_mount_drive | length == 0
- ('Windows Server 2008' in ansible_distribution)
- name: Get list of all drivers
win_command: driverquery /V
changed_when: false
register: driver_list
- name: Check if Red Hat certificate is not already installed
win_shell: 'Get-ChildItem -Path Cert:\LocalMachine\TrustedPublisher'
changed_when: false
register: cert_check
- include_tasks: install_cert.yml
when: cert_check.stdout is not search("Red Hat")
- include_tasks: install_drivers.yml

View File

@@ -0,0 +1,22 @@
---
- name: Export Cert from qxldod
win_shell: '$cert = (Get-AuthenticodeSignature "{{ virtio_win_virtio_path }}\qxldod\{{ virtio_driver_directory }}\amd64\qxldod.cat").SignerCertificate; [System.IO.File]::WriteAllBytes("{{ ansible_env.TEMP }}\redhat_qxldod.cer", $cert.Export([System.Security.Cryptography.X509Certificates.X509ContentType]::Cert));'
when: virtio_driver_directory != '2k8R2'
- name: Export Cert from qxl
win_shell: '$cert = (Get-AuthenticodeSignature "{{ virtio_win_virtio_path }}\qxl\{{ virtio_driver_directory }}\amd64\qxl.cat").SignerCertificate; [System.IO.File]::WriteAllBytes("{{ ansible_env.TEMP }}\redhat_qxldod.cer", $cert.Export([System.Security.Cryptography.X509Certificates.X509ContentType]::Cert));'
when: virtio_driver_directory == '2k8R2'
- name: Export Cert from balloon
win_shell: '$cert = (Get-AuthenticodeSignature "{{ virtio_win_virtio_path }}\Balloon\{{ virtio_driver_directory }}\amd64\blnsvr.exe").SignerCertificate; [System.IO.File]::WriteAllBytes("{{ ansible_env.TEMP }}\redhat_balloon.cer", $cert.Export([System.Security.Cryptography.X509Certificates.X509ContentType]::Cert));'
- name: Install RH certificate (qxldod) to TrustedPublisher certificate store
win_command: 'certutil.exe -f -addstore "TrustedPublisher" {{ ansible_env.TEMP }}\redhat_qxldod.cer'
notify:
- Delete downloaded
- name: Install RH certificate (Balloon) to TrustedPublisher certificate store
win_command: 'certutil.exe -f -addstore "TrustedPublisher" {{ ansible_env.TEMP }}\redhat_balloon.cer'
notify:
- Delete downloaded

View File

@@ -0,0 +1,45 @@
---
- name: Install the Virtio Network Driver (netkvm)
win_command: "pnputil -i -a \"{{ virtio_win_virtio_path }}\\NetKVM\\{{ virtio_driver_directory }}\\{{ ansible_env.PROCESSOR_ARCHITECTURE | lower }}\\*.inf\""
when: driver_list.stdout is not search("netkvm")
- name: Install the Virtio Block Driver (viostor)
win_command: "pnputil -i -a \"{{ virtio_win_virtio_path }}\\viostor\\{{ virtio_driver_directory }}\\{{ ansible_env.PROCESSOR_ARCHITECTURE | lower }}\\*.inf\""
when: driver_list.stdout is not search("viostor")
- name: Install the QXL Graphics Driver (qxldod)
win_command: "pnputil -i -a \"{{ virtio_win_virtio_path }}\\qxldod\\{{ virtio_driver_directory }}\\{{ ansible_env.PROCESSOR_ARCHITECTURE | lower }}\\*.inf\""
when:
- driver_list.stdout is not search("qxldod")
- virtio_driver_directory != '2k8R2'
- name: Install the QXL Graphics Driver (qxl)
win_command: "pnputil -i -a \"{{ virtio_win_virtio_path }}\\qxl\\{{ virtio_driver_directory }}\\{{ ansible_env.PROCESSOR_ARCHITECTURE | lower }}\\*.inf\""
when:
- driver_list.stdout is not search("qxl")
- virtio_driver_directory == '2k8R2'
- name: Install the Balloon Driver (Balloon)
win_command: "pnputil -i -a \"{{ virtio_win_virtio_path }}\\Balloon\\{{ virtio_driver_directory }}\\{{ ansible_env.PROCESSOR_ARCHITECTURE | lower }}\\*.inf\""
when: driver_list.stdout is not search("balloon")
- name: Install Virtio RNG driver (viorng)
win_command: "pnputil -i -a \"{{ virtio_win_virtio_path }}\\viorng\\{{ virtio_driver_directory }}\\{{ ansible_env.PROCESSOR_ARCHITECTURE | lower }}\\*.inf\""
when: driver_list.stdout is not search("viorng")
- name: Install Virtio serial driver (vioserial)
win_command: "pnputil -i -a \"{{ virtio_win_virtio_path }}\\vioserial\\{{ virtio_driver_directory }}\\{{ ansible_env.PROCESSOR_ARCHITECTURE | lower }}\\*.inf\""
when: driver_list.stdout is not search("vioser")
- name: Install Virtio Input driver (vioinput)
win_command: "pnputil -i -a \"{{ virtio_win_virtio_path }}\\vioinput\\{{ virtio_driver_directory }}\\{{ ansible_env.PROCESSOR_ARCHITECTURE | lower }}\\*.inf\""
when: driver_list.stdout is not search("vioinput")
- name: Install Virtio SCSI Passthrough driver (vioscsi)
win_command: "pnputil -i -a \"{{ virtio_win_virtio_path }}\\vioscsi\\{{ virtio_driver_directory }}\\{{ ansible_env.PROCESSOR_ARCHITECTURE | lower }}\\*.inf\""
when: driver_list.stdout is not search("vioscsi")
- name: Install pvpanic device driver (pvpanic)
win_command: "pnputil -i -a \"{{ virtio_win_virtio_path }}\\pvpanic\\{{ virtio_driver_directory }}\\{{ ansible_env.PROCESSOR_ARCHITECTURE | lower }}\\*.inf\""
when: driver_list.stdout is not search("pvpanic")

View File

@@ -0,0 +1,25 @@
---
- name: check new version of virtio
uri:
url: "{{ virtio_changelog_url }}"
return_content: true
validate_certs: no
register: register_virtio_changelog
ignore_errors: yes
delegate_to: localhost
become: no
vars:
ansible_connection: local
- name: set virtio version facts
set_fact:
virtio_version: "{{ register_virtio_changelog.content | regex_search(virtio_changelog_query) | default('0.0') }}"
- include_tasks: download.yml
when:
- virtio_iso_mount_drive | length == 0
- (ansible_virtio_version | default()) != virtio_version
- include_tasks: install.yml
when: virtio_iso_mount_drive | length > 0 or (ansible_virtio_version | default()) != virtio_version