Find latest ISO images automatically.
This commit is contained in:
parent
e61a8b899c
commit
291866eb93
2 changed files with 53 additions and 31 deletions
29
livebox.yml
29
livebox.yml
|
@ -31,14 +31,12 @@
|
||||||
- di-netboot-assistant
|
- di-netboot-assistant
|
||||||
- apt-cacher-ng
|
- apt-cacher-ng
|
||||||
|
|
||||||
live_images:
|
live_desktop:
|
||||||
- iso: 'debian-live-11.3.0-amd64-gnome+nonfree.iso'
|
- gnome
|
||||||
name: 'gnome'
|
- kde
|
||||||
- iso: 'debian-live-11.3.0-amd64-kde+nonfree.iso'
|
- standard
|
||||||
name: 'kde'
|
|
||||||
- iso: 'debian-live-11.3.0-amd64-standard+nonfree.iso'
|
live_url: 'https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/current-live/amd64/iso-hybrid/'
|
||||||
name: 'standard-cli'
|
|
||||||
live_url: 'https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/11.3.0-live+nonfree/amd64/iso-hybrid/'
|
|
||||||
|
|
||||||
# The edulive role generates customized Debian-Live images.
|
# The edulive role generates customized Debian-Live images.
|
||||||
# Make sure you have sufficient disk space available (~30GiB?).
|
# Make sure you have sufficient disk space available (~30GiB?).
|
||||||
|
@ -68,6 +66,21 @@
|
||||||
value: /var/lib/tftpboot
|
value: /var/lib/tftpboot
|
||||||
vtype: string
|
vtype: string
|
||||||
|
|
||||||
|
- name: find available iso images
|
||||||
|
uri:
|
||||||
|
url: "{{ live_url }}"
|
||||||
|
return_content: true
|
||||||
|
register: idx
|
||||||
|
|
||||||
|
- name: find and set ISO image version
|
||||||
|
set_fact:
|
||||||
|
version: "{{ idx.content | regex_findall('debian-live-(\\d+\\.\\d+\\.\\d+)-amd64-', '\\1') | first }}"
|
||||||
|
|
||||||
|
- name: define ISO image map
|
||||||
|
set_fact:
|
||||||
|
live_iso: "{{ live_iso | default({}) | combine({ item: 'debian-live-' + version + '-amd64-' + item + '+nonfree.iso' }) }}"
|
||||||
|
loop: "{{ live_desktop }}"
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- up2date_debian
|
- up2date_debian
|
||||||
- netbootinstaller
|
- netbootinstaller
|
||||||
|
|
|
@ -1,19 +1,28 @@
|
||||||
---
|
---
|
||||||
- name: download debian-live images
|
- name: download debian-live images
|
||||||
get_url:
|
get_url:
|
||||||
url: "{{ live_url }}{{ item.iso }}"
|
url: "{{ live_url }}{{ item.value }}"
|
||||||
dest: "/var/cache/di-netboot-assistant/{{ item.iso }}"
|
dest: "/var/cache/di-netboot-assistant/{{ item.value }}"
|
||||||
checksum: "sha256:{{ live_url }}/SHA256SUMS"
|
checksum: "sha256:{{ live_url }}/SHA256SUMS"
|
||||||
|
register: new_iso
|
||||||
loop:
|
loop:
|
||||||
"{{ live_images }}"
|
"{{ live_iso | dict2items }}"
|
||||||
|
|
||||||
|
- name: umount old iso images
|
||||||
|
mount:
|
||||||
|
path: "/var/lib/tftpboot/d-i/n-live/{{ item.key }}"
|
||||||
|
state: unmounted
|
||||||
|
loop:
|
||||||
|
"{{ live_iso | dict2items }}"
|
||||||
|
when: new_iso.changed
|
||||||
|
|
||||||
- name: prepare live image directory
|
- name: prepare live image directory
|
||||||
file:
|
file:
|
||||||
path: "/var/lib/tftpboot/d-i/n-live/{{ item.name }}"
|
path: "/var/lib/tftpboot/d-i/n-live/{{ item.key }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
loop:
|
loop:
|
||||||
"{{ live_images }}"
|
"{{ live_iso | dict2items }}"
|
||||||
|
|
||||||
- name: make sure loop module is loaded
|
- name: make sure loop module is loaded
|
||||||
modprobe:
|
modprobe:
|
||||||
|
@ -22,13 +31,13 @@
|
||||||
|
|
||||||
- name: loop mount iso images
|
- name: loop mount iso images
|
||||||
mount:
|
mount:
|
||||||
path: "/var/lib/tftpboot/d-i/n-live/{{ item.name }}"
|
path: "/var/lib/tftpboot/d-i/n-live/{{ item.key }}"
|
||||||
src: "/var/cache/di-netboot-assistant/{{ item.iso }}"
|
src: "/var/cache/di-netboot-assistant/{{ item.value }}"
|
||||||
fstype: iso9660
|
fstype: iso9660
|
||||||
opts: loop,ro,nofail
|
opts: loop,ro,nofail
|
||||||
state: mounted
|
state: mounted
|
||||||
loop:
|
loop:
|
||||||
"{{ live_images }}"
|
"{{ live_iso | dict2items }}"
|
||||||
notify: rebuild di-netboot menu
|
notify: rebuild di-netboot menu
|
||||||
|
|
||||||
- name: prepare http downloads
|
- name: prepare http downloads
|
||||||
|
@ -71,32 +80,32 @@
|
||||||
lineinfile:
|
lineinfile:
|
||||||
path: /etc/di-netboot-assistant/ipxemenu.HEAD
|
path: /etc/di-netboot-assistant/ipxemenu.HEAD
|
||||||
insertafter: '-- Customized Boot Entries --'
|
insertafter: '-- Customized Boot Entries --'
|
||||||
line: "item {{ item.name }} Debian GNU/Linux {{ item.name }} NFS"
|
line: "item {{ item.key }} Debian GNU/Linux {{ item.key }} NFS"
|
||||||
loop:
|
loop:
|
||||||
"{{ live_images }}"
|
"{{ live_iso | dict2items }}"
|
||||||
notify: rebuild di-netboot menu
|
notify: rebuild di-netboot menu
|
||||||
|
|
||||||
- name: find kernel version
|
- name: find kernel version
|
||||||
shell:
|
shell:
|
||||||
cmd: >-
|
cmd: >-
|
||||||
basename /var/lib/tftpboot/d-i/n-live/{{ item.name }}/live/vmlinuz*
|
basename /var/lib/tftpboot/d-i/n-live/{{ item.key }}/live/vmlinuz*
|
||||||
| sed "s/vmlinuz-//"
|
| sed "s/vmlinuz-//"
|
||||||
register: images
|
register: images
|
||||||
changed_when: false
|
changed_when: false
|
||||||
loop:
|
loop:
|
||||||
"{{ live_images }}"
|
"{{ live_iso | dict2items }}"
|
||||||
|
|
||||||
- name: prepare debian live boot loader ipxe
|
- name: prepare debian live boot loader ipxe
|
||||||
blockinfile:
|
blockinfile:
|
||||||
path: /etc/di-netboot-assistant/ipxemenu.HEAD
|
path: /etc/di-netboot-assistant/ipxemenu.HEAD
|
||||||
marker: "# {mark} ANSIBLE MANAGED BLOCK {{ item.item.name }}"
|
marker: "# {mark} ANSIBLE MANAGED BLOCK {{ item.item.key }}"
|
||||||
block: |
|
block: |
|
||||||
:{{ item.item.name }}
|
:{{ item.item.key }}
|
||||||
echo Booting Debian GNU/Linux {{ item.item.name }} NFS
|
echo Booting Debian GNU/Linux {{ item.item.key }} NFS
|
||||||
kernel ${210:string}d-i/n-live/{{ item.item.name }}/live/vmlinuz-{{ item.stdout }} \
|
kernel ${210:string}d-i/n-live/{{ item.item.key }}/live/vmlinuz-{{ item.stdout }} \
|
||||||
initrd=initrd.img-5.10.0-13-amd64 {{ boot_params|join(' ') }} \
|
initrd=initrd.img-5.10.0-13-amd64 {{ boot_params|join(' ') }} \
|
||||||
nfsroot={{ ansible_default_ipv4.address }}:/var/lib/tftpboot/d-i/n-live/{{ item.item.name }}/
|
nfsroot={{ ansible_default_ipv4.address }}:/var/lib/tftpboot/d-i/n-live/{{ item.item.key }}/
|
||||||
initrd ${210:string}d-i/n-live/{{ item.item.name }}/live/initrd.img-{{ item.stdout }}
|
initrd ${210:string}d-i/n-live/{{ item.item.key }}/live/initrd.img-{{ item.stdout }}
|
||||||
boot
|
boot
|
||||||
loop:
|
loop:
|
||||||
"{{ images.results }}"
|
"{{ images.results }}"
|
||||||
|
@ -106,13 +115,13 @@
|
||||||
blockinfile:
|
blockinfile:
|
||||||
path: /etc/di-netboot-assistant/grub.cfg.HEAD
|
path: /etc/di-netboot-assistant/grub.cfg.HEAD
|
||||||
insertbefore: "^menuentry 'Boot from local disk..'"
|
insertbefore: "^menuentry 'Boot from local disk..'"
|
||||||
marker: "# {mark} ANSIBLE MANAGED BLOCK {{ item.item.name }}"
|
marker: "# {mark} ANSIBLE MANAGED BLOCK {{ item.item.key }}"
|
||||||
block: |
|
block: |
|
||||||
menuentry 'Debian GNU/Linux Live {{ item.item.name }} NFS' {
|
menuentry 'Debian GNU/Linux Live {{ item.item.key }} NFS' {
|
||||||
linux (http,{{ ansible_default_ipv4.address }})/d-i/n-live/{{ item.item.name }}/live/vmlinuz-{{ item.stdout }} \
|
linux (http,{{ ansible_default_ipv4.address }})/d-i/n-live/{{ item.item.key }}/live/vmlinuz-{{ item.stdout }} \
|
||||||
{{ boot_params|join(' ') }} \
|
{{ boot_params|join(' ') }} \
|
||||||
nfsroot={{ ansible_default_ipv4.address }}:/var/lib/tftpboot/d-i/n-live/{{ item.item.name }}/
|
nfsroot={{ ansible_default_ipv4.address }}:/var/lib/tftpboot/d-i/n-live/{{ item.item.key }}/
|
||||||
initrd (http,{{ ansible_default_ipv4.address }})/d-i/n-live/{{ item.item.name }}/live/initrd.img-{{ item.stdout }}
|
initrd (http,{{ ansible_default_ipv4.address }})/d-i/n-live/{{ item.item.key }}/live/initrd.img-{{ item.stdout }}
|
||||||
}
|
}
|
||||||
loop:
|
loop:
|
||||||
"{{ images.results }}"
|
"{{ images.results }}"
|
||||||
|
|
Loading…
Add table
Reference in a new issue