aboutsummaryrefslogtreecommitdiffstats
path: root/roles/vmm/tasks/download_iso.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/vmm/tasks/download_iso.yml')
-rw-r--r--roles/vmm/tasks/download_iso.yml34
1 files changed, 34 insertions, 0 deletions
diff --git a/roles/vmm/tasks/download_iso.yml b/roles/vmm/tasks/download_iso.yml
new file mode 100644
index 0000000..c767c05
--- /dev/null
+++ b/roles/vmm/tasks/download_iso.yml
@@ -0,0 +1,34 @@
+
+# vmm ~~ tasks/download_iso.yml
+
+---
+
+- meta: end_play
+ when: iso is not defined
+
+- set_fact:
+ symlink: "{{ vmm.iso.dir }}/{{ vmm.iso[iso].name }}-latest.iso"
+
+- set_fact:
+ dest: "{{ symlink | regex_replace('latest', vmm.iso[iso].version) }}"
+ url: "{{ vmm.iso[iso].url \
+ | regex_replace('VERSIONDIR', vmm.iso[iso].versiondir) \
+ | regex_replace('VERSION', vmm.iso[iso].version) }}"
+
+ sha256: "{{ vmm.iso[iso].sha256 \
+ | regex_replace('VERSIONDIR', vmm.iso[iso].versiondir) \
+ | regex_replace('VERSION', vmm.iso[iso].version) }}"
+
+- name: Get latest iso
+ get_url:
+ url: "{{ url }}"
+ dest: "{{ dest }}"
+ force: "{{ force | default('no') }}"
+ checksum: "sha256:{{ sha256 }}"
+
+- name: Symlink latest iso
+ file:
+ src: "{{ dest }}"
+ dest: "{{ symlink }}"
+ state: link
+
remember that computers suck.