From 13d1d960b709151562410040a2c122aa9d6238be Mon Sep 17 00:00:00 2001 From: Kris Lamoureux Date: Mon, 21 Sep 2020 19:21:30 -0400 Subject: [PATCH] Prevent rehashing ISO downloads --- roles/libvirt/tasks/main.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/roles/libvirt/tasks/main.yml b/roles/libvirt/tasks/main.yml index 29e9080..c820aa7 100644 --- a/roles/libvirt/tasks/main.yml +++ b/roles/libvirt/tasks/main.yml @@ -16,6 +16,11 @@ with_items: "{{ libvirt_users }}" when: libvirt_users is defined +- name: Check for NODOWNLOAD file + stat: + path: /var/lib/libvirt/images/NODOWNLOAD + register: NODOWNLOAD + - name: Download GNU/Linux ISOs get_url: url: "{{ item.url }}" @@ -24,4 +29,12 @@ owner: libvirt-qemu group: libvirt-qemu loop: "{{ libvirt_isos }}" - when: libvirt_isos is defined + register: download_isos + when: libvirt_isos is defined and NODOWNLOAD.stat.exists == false + +# Prevent downloaded ISOs from being rehashed every run +- name: Create NODOWNLOAD file + file: + path: /var/lib/libvirt/images/NODOWNLOAD + state: touch + when: download_isos.changed