blob: 946b659561b45ef2b502c7b9881a0dea36d2780c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# vmm isos ~~ roles/vmm/tasks/isos.yml
# download an iso file to hypervisor.
---
- name: Check arguments
fail:
msg: "arguments : iso"
when: iso is not defined
- name: ensure guest exists
set_fact:
disk_file: "{{ vmm.disk_dir }}/{{ guest }}.{{ vmm.disk_format }}"
when: guest is defined
- name: generate iso infos 1/2
set_fact:
iso_latest: "{{ vmm.iso_dir }}/{{ vmm.iso[iso].name }}-latest.iso"
when: iso is defined
- name: generate iso infos 2/2
set_fact:
iso_file: "{{ iso_latest | regex_replace('latest', vmm.iso[iso].version) }}"
iso_url: "{{ vmm.iso[iso].url \
| regex_replace('VERSIONDIR', vmm.iso[iso].versiondir) \
| regex_replace('VERSION', vmm.iso[iso].version) }}"
iso_checksum: "{{ vmm.iso[iso].sha256 \
| regex_replace('VERSIONDIR', vmm.iso[iso].versiondir) \
| regex_replace('VERSION', vmm.iso[iso].version) }}"
when: iso is defined
- name: Get latest iso
get_url:
url: "{{ iso_url }}"
dest: "{{ iso_file }}"
force: "{{ force | default('no') }}"
checksum: "sha256:{{ iso_checksum }}"
- name: Symlink latest iso
file:
src: "{{ iso_file }}"
dest: "{{ iso_latest }}"
state: link
|