Prevent rehashing ISO downloads

This commit is contained in:
Kris Lamoureux 2020-09-21 19:21:30 -04:00
parent 8fc599113e
commit 13d1d960b7
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925

View File

@ -16,6 +16,11 @@
with_items: "{{ libvirt_users }}" with_items: "{{ libvirt_users }}"
when: libvirt_users is defined when: libvirt_users is defined
- name: Check for NODOWNLOAD file
stat:
path: /var/lib/libvirt/images/NODOWNLOAD
register: NODOWNLOAD
- name: Download GNU/Linux ISOs - name: Download GNU/Linux ISOs
get_url: get_url:
url: "{{ item.url }}" url: "{{ item.url }}"
@ -24,4 +29,12 @@
owner: libvirt-qemu owner: libvirt-qemu
group: libvirt-qemu group: libvirt-qemu
loop: "{{ libvirt_isos }}" 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