This commit is contained in:
jonas 2021-10-19 13:29:24 +02:00
parent 6edffbc0fd
commit b9f68281af
3 changed files with 10 additions and 3 deletions

View File

@ -17,6 +17,8 @@ tlu-harvester:
url: https://download.opensuse.org/distribution/leap/15.3/appliances/openSUSE-Leap-15.3-JeOS.x86_64-kvm-and-xen.qcow2
checksum: da11e3ed78cdadb0c8a15e9dd82c3c2b2746ba61cb98c3c03cfb156e5b8adb10
ns: default
- name: MicroOS
url: https://download.opensuse.org/tumbleweed/appliances/openSUSE-MicroOS.x86_64-kvm-and-xen.qcow2
ubuntu:
- name: ubuntu 20.04 (Focal Fossa)
url: https://cloud-images.ubuntu.com/focal/20211015/focal-server-cloudimg-amd64-disk-kvm.img

View File

@ -1,13 +1,16 @@
{% for dist, items in pillar['tlu-harvester']['images'].items() -%}
{% for item in items -%}
{% set name = item['checksum'][-10:] if 'checksum' in item else salt['random.hash'](item['url'], 'md5')[-10:] -%}
{% set displayName = item['name'] if 'name' in item else item['url'].split('/')[-1] -%}
{% set ns = item['ns'] if 'ns' in item else 'default' -%}
---
apiVersion: harvesterhci.io/v1beta1
kind: VirtualMachineImage
metadata:
name: {{ item['checksum'][-10:] }}
namespace: {{ item['ns'] | default('default') }}
name: {{ name }}
namespace: {{ ns }}
spec:
displayName: {{ item['name'] | default(item['url'].split('/')[-1]) }}
displayName: {{ displayName }}
pvcName: ""
pvcNamespace: ""
sourceType: download

View File

@ -5,7 +5,9 @@ Downloading image {{ filename }}:
file.managed:
- name: /srv/www/htdocs/images/{{ dist }}/{{ filename }}
- source: {{ item['url'] }}
{% if 'checksum' in item -%}
- source_hash: {{ item['checksum'] }}
{% endif %}
- user: root
- group: root
- mode: "0644"