---

- 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