diff options
author | binary <me@rgoncalves.se> | 2020-11-07 20:38:07 +0100 |
---|---|---|
committer | binary <me@rgoncalves.se> | 2020-11-07 20:38:07 +0100 |
commit | 352c98322771af117a85904d580e1c062062d634 (patch) | |
tree | d3bca9d27d6ee5d678264d83fc22030d274f30bf /roles/vmm/tasks/download_iso.yml | |
parent | 282be811d2ac07a76d56ac066df5bf33d748bd64 (diff) | |
download | infrastructure-352c98322771af117a85904d580e1c062062d634.tar.gz |
Refactor vmm role with automation
Diffstat (limited to 'roles/vmm/tasks/download_iso.yml')
-rw-r--r-- | roles/vmm/tasks/download_iso.yml | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/roles/vmm/tasks/download_iso.yml b/roles/vmm/tasks/download_iso.yml index c767c05..6f0c5f6 100644 --- a/roles/vmm/tasks/download_iso.yml +++ b/roles/vmm/tasks/download_iso.yml @@ -1,34 +1,28 @@ # vmm ~~ tasks/download_iso.yml +# Download an iso file to hypervisor. +# Required : +# - iso : name of an iso file defined in vars/main.yml --- -- meta: end_play +- name: Check arguments + fail: + msg: "arguments : iso" 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) }}" +- include: set_facts.yml - name: Get latest iso get_url: - url: "{{ url }}" - dest: "{{ dest }}" + url: "{{ iso_url }}" + dest: "{{ iso_file }}" force: "{{ force | default('no') }}" - checksum: "sha256:{{ sha256 }}" + checksum: "sha256:{{ iso_checksum }}" - name: Symlink latest iso file: - src: "{{ dest }}" - dest: "{{ symlink }}" + src: "{{ iso_file }}" + dest: "{{ iso_latest }}" state: link |