true autoinstall
This commit is contained in:
parent
f4f973327c
commit
b05ebe8013
|
@ -13,11 +13,21 @@
|
||||||
path: "{{playbook_dir}}/files/ubuntu20_04.iso"
|
path: "{{playbook_dir}}/files/ubuntu20_04.iso"
|
||||||
register: isoexists
|
register: isoexists
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
- name: Check for ubuntu iso seed
|
- name: Check for seed iso
|
||||||
stat:
|
stat:
|
||||||
path: "{{userdata}}/seed.iso"
|
path: "{{userdata}}/seed.iso"
|
||||||
register: seedexists
|
register: seedexists
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
- name: Check for extracted linux kernel
|
||||||
|
stat:
|
||||||
|
path: "{{userdata}}/vmlinuz"
|
||||||
|
register: kernelexists
|
||||||
|
ignore_errors: true
|
||||||
|
- name: Check for extracted initrd
|
||||||
|
stat:
|
||||||
|
path: "{{userdata}}/initrd"
|
||||||
|
register: initrdexists
|
||||||
|
ignore_errors: true
|
||||||
|
|
||||||
# Setting up VM
|
# Setting up VM
|
||||||
- name: Create directory for VM
|
- name: Create directory for VM
|
||||||
|
@ -40,6 +50,16 @@
|
||||||
command: "genisoimage -output {{userdata}}/seed.iso -volid cidata -joliet -rock {{playbook_dir}}/files/user-data {{playbook_dir}}/files/meta-data"
|
command: "genisoimage -output {{userdata}}/seed.iso -volid cidata -joliet -rock {{playbook_dir}}/files/user-data {{playbook_dir}}/files/meta-data"
|
||||||
when: seedexists.stat.exists == false
|
when: seedexists.stat.exists == false
|
||||||
|
|
||||||
|
- name: Extracting linux kernel from iso
|
||||||
|
shell:
|
||||||
|
cmd: "isoinfo -i {{playbook_dir}}/files/ubuntu20_04.iso -R -x /casper/vmlinuz > {{userdata}}/vmlinuz"
|
||||||
|
when: kernelexists.stat.exists == false
|
||||||
|
|
||||||
|
- name: Extracting initrd from iso
|
||||||
|
shell:
|
||||||
|
cmd: "isoinfo -i {{playbook_dir}}/files/ubuntu20_04.iso -R -x /casper/initrd > {{userdata}}/initrd"
|
||||||
|
when: initrdexists.stat.exists == false
|
||||||
|
|
||||||
- name: Starting autoinstallation
|
- name: Starting autoinstallation
|
||||||
shell:
|
shell:
|
||||||
cmd: "qemu-system-x86_64 -cdrom {{playbook_dir}}/files/ubuntu20_04.iso \
|
cmd: "qemu-system-x86_64 -cdrom {{playbook_dir}}/files/ubuntu20_04.iso \
|
||||||
|
@ -52,7 +72,9 @@
|
||||||
-drive file={{userdata}}/drive6,if=virtio,id=f,media=disk,format=qcow2 \
|
-drive file={{userdata}}/drive6,if=virtio,id=f,media=disk,format=qcow2 \
|
||||||
-drive file={{userdata}}/seed.iso,if=virtio,format=raw \
|
-drive file={{userdata}}/seed.iso,if=virtio,format=raw \
|
||||||
-bios {{ovmf}} \
|
-bios {{ovmf}} \
|
||||||
-m {{vm_ram}}"
|
-m {{vm_ram}} \
|
||||||
|
-kernel {{userdata}}/vmlinuz \
|
||||||
|
-initrd {{userdata}}/initrd \
|
||||||
|
-append autoinstall"
|
||||||
|
|
||||||
# todo: find a way to not ask for confirmation to start autoinstall
|
|
||||||
# bug: autoinstall will not shutdown properly so the ansible task will never finish
|
# bug: autoinstall will not shutdown properly so the ansible task will never finish
|
||||||
|
|
Loading…
Reference in New Issue