forked from ScaleComputing/HyperCoreAnsibleCollection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
iso.yml
40 lines (35 loc) · 1.31 KB
/
iso.yml
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
---
- name: Upload ISO image from http link to HyperCore
hosts: localhost
connection: local
gather_facts: false
vars:
iso_url: http://tinycorelinux.net/13.x/x86/release/TinyCore-current.iso
iso_filename: "{{ iso_url | split('/') | last }}"
iso_remove_old_image: false
tasks:
# ------------------------------------------------------
- name: Download ISO {{ iso_filename }} from URL
ansible.builtin.get_url:
url: "{{ iso_url }}"
dest: /tmp/{{ iso_filename }}
- name: (Optionally) remove existing ISO {{ iso_filename }} from HyperCore
scale_computing.hypercore.iso:
name: "{{ iso_filename }}"
source: /tmp/{{ iso_filename }}
state: absent
when: iso_remove_old_image
# ------------------------------------------------------
- name: Upload ISO {{ iso_filename }} to HyperCore
scale_computing.hypercore.iso:
name: "{{ iso_filename }}"
source: /tmp/{{ iso_filename }}
state: present
# ------------------------------------------------------
- name: Get info about specific ISO image - {{ iso_filename }}
scale_computing.hypercore.iso_info:
name: "{{ iso_filename }}"
register: iso_results
- name: Show info about {{ iso_filename }} ISO
debug:
var: iso_results.records[0]