From 04b6350fd3b4f3650a49fa9f7bbd7bfa64d8d173 Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Sat, 16 Oct 2021 15:09:54 +0200 Subject: [PATCH] . --- salt/pillars/pxe.sls | 8 +++- salt/states/nginx/files/harvester/.gitignore | 4 ++ .../pxe/harvester/files/harvester.cfg.jinja | 11 +++++ salt/states/pxe/harvester/init.sls | 47 +++++++++++++++++++ 4 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 salt/states/nginx/files/harvester/.gitignore create mode 100644 salt/states/pxe/harvester/files/harvester.cfg.jinja diff --git a/salt/pillars/pxe.sls b/salt/pillars/pxe.sls index 643c05c..8a18f24 100644 --- a/salt/pillars/pxe.sls +++ b/salt/pillars/pxe.sls @@ -1,4 +1,8 @@ pxe: harvester: - versions: - - 0.3.0 + - version: 0.3.0 + hash: + iso: a5c6ef5081fa844b1a13689e8a0dbbd57ea4d58202a0f4b0c05d12c60955f6e2 + initrd: 6d7899c381da7bf10a70991d024c6b6ab17a26d477b0523704076c43548922a1 + rootfs: dd8fb6118431ec9175beb6561a91027128841e46fdc6dff3b671dccc798f6aed + vmlinuz: 6887e6a026f47509c729fb3fe1527f06adae15eb0f31982f52dcf86f3237fd1a diff --git a/salt/states/nginx/files/harvester/.gitignore b/salt/states/nginx/files/harvester/.gitignore new file mode 100644 index 0000000..5e7d273 --- /dev/null +++ b/salt/states/nginx/files/harvester/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore diff --git a/salt/states/pxe/harvester/files/harvester.cfg.jinja b/salt/states/pxe/harvester/files/harvester.cfg.jinja new file mode 100644 index 0000000..191164c --- /dev/null +++ b/salt/states/pxe/harvester/files/harvester.cfg.jinja @@ -0,0 +1,11 @@ +## Menu Colours +set menu_color_normal=white/black +set menu_color_highlight=white/green + +{% for item in pillar['pxe']['harvester'] -%} +menuentry 'Harvester {{ item['version'] }}' --class os { + linux harvester-v{{ item['version'] }}-vmlinuz-amd64 nomodeset initrd=harvester-v{{ item['version'] }}-initrd-amd64 ip=dhcp net.ifnames=1 rd.cos.disable rd.noverifyssl console=tty1 root=live:http://{{ pillar['network']['ip'] }}/harvester/harvester-v{{ item['version'] }}-rootfs-amd64.squashfs iso_url=http://{{ pillar['network']['ip'] }}/harvester/harvester-v{{ item['version'] }}-amd64.iso + initrd harvester-v{{ item['version'] }}-initrd-amd64 + boot +} +{% endfor %} diff --git a/salt/states/pxe/harvester/init.sls b/salt/states/pxe/harvester/init.sls index e69de29..c643beb 100644 --- a/salt/states/pxe/harvester/init.sls +++ b/salt/states/pxe/harvester/init.sls @@ -0,0 +1,47 @@ +{% for item in pillar['pxe']['harvester'] -%} +Download harvester {{ item['version'] }} ISO: + file.managed: + - name: /srv/www/htdocs/harvester/harvester-v{{ item['version'] }}-amd64.iso + - source: https://releases.rancher.com/harvester/v{{ item['version'] }}/harvester-v{{ item['version'] }}-amd64.iso + - source_hash: {{ item['hash']['iso'] }} + - user: root + - group: root + - mode: "0644" + +Download harvester {{ item['version'] }} initrd: + file.managed: + - name: /srv/tftpboot/harvester-v{{ item['version'] }}-initrd-amd64 + - source: https://releases.rancher.com/harvester/v{{ item['version'] }}/harvester-v{{ item['version'] }}-initrd-amd64 + - source_hash: {{ item['hash']['initrd'] }} + - user: root + - group: root + - mode: "0644" + +Download harvester {{ item['version'] }} wmlinuz: + file.managed: + - name: /srv/tftpboot/harvester-v{{ item['version'] }}-vmlinuz-amd64 + - source: https://releases.rancher.com/harvester/v{{ item['version'] }}/harvester-v{{ item['version'] }}-vmlinuz-amd64 + - source_hash: {{ item['hash']['vmlinuz'] }} + - user: root + - group: root + - mode: "0644" + +Download harvester {{ item['version'] }} rootfs: + file.managed: + - name: /srv/www/htdocs/harvester/harvester-v{{ item['version'] }}-rootfs-amd64.squashfs + - source: https://releases.rancher.com/harvester/v{{ item['version'] }}/harvester-v{{ item['version'] }}-rootfs-amd64.squashfs + - source_hash: {{ item['hash']['rootfs'] }} + - user: root + - group: root + - mode: "0644" + +{% endfor %} + +Update harvester grub file: + file.managed: + - name: /srv/tftpboot/harvester.cfg + - source: salt://pxe/harvester/files/harvester.cfg.jinja + - template: jinja + - user: root + - group: root + - mode: "0644"