fixed variables in qemu
This commit is contained in:
parent
884c437e7b
commit
1f966eedd0
|
@ -1,2 +1,2 @@
|
|||
[defaults]
|
||||
inventory = hosts.yml
|
||||
inventory = hosts
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
# not required for libvirt
|
||||
# ovmf: /usr/share/edk1-ovmf/x64/OVMF_CODE.fd
|
||||
ovmf:
|
||||
vm_ram: 1G
|
||||
userdata: "{{ playbook_dir }}/userdata"
|
||||
vm_disk_size: 9G
|
||||
vm_ssh_port: 22
|
||||
|
||||
# need to redo variables
|
||||
# not being called correctly in playbooks
|
2
hosts
2
hosts
|
@ -7,4 +7,4 @@
|
|||
# guide on how to create vm manually (more control, more disks)
|
||||
# another playbook that runs on such a vm and sets up all the services in roles (except zfs)
|
||||
[local]
|
||||
127.0.0.1 ansible_connection=local
|
||||
127.0.0.1 ansible_connection=local
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
---
|
||||
# Gather info
|
||||
- hosts: localhost
|
||||
vars:
|
||||
ovmf:
|
||||
vm_ram: 1G
|
||||
vm_disk_size: 9G
|
||||
vm_ssh_port: 22
|
||||
userdata: "{{playbook_dir}}/userdata"
|
||||
tasks:
|
||||
- name: Check if vm was created already
|
||||
stat:
|
||||
|
@ -9,7 +15,7 @@
|
|||
ignore_errors: true
|
||||
- name: Check for ubuntu iso
|
||||
stat:
|
||||
path: "{{role_path}}/files/ubuntu20_04.iso"
|
||||
path: "{{playbook_dir}}/files/ubuntu20_04.iso"
|
||||
register: isoexists
|
||||
ignore_errors: true
|
||||
- name: Check for ubuntu iso seed
|
||||
|
@ -27,7 +33,7 @@
|
|||
|
||||
# didn't use get_url module since it broke with symlinks
|
||||
- name: Fetching ubuntu iso
|
||||
command: curl -o "{{role_path}}/files/ubuntu20_04.iso" https://releases.ubuntu.com/20.04.3/ubuntu-20.04.3-live-server-amd64.iso
|
||||
command: curl -o "{{playbook_dir}}/files/ubuntu20_04.iso" https://releases.ubuntu.com/20.04.3/ubuntu-20.04.3-live-server-amd64.iso
|
||||
when: isoexists.stat.exists == false
|
||||
|
||||
- name: Create disk images
|
||||
|
@ -36,12 +42,12 @@
|
|||
when: vmexists.stat.exists == false
|
||||
|
||||
- name: Creating cloud-init iso
|
||||
command: "genisoimage -output {{userdata}}/seed.iso -volid cidata -joliet -rock {{role_path}}/files/user-data {{role_path}}/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
|
||||
|
||||
- name: Starting autoinstallation
|
||||
shell:
|
||||
cmd: "qemu-system-x86_64 -cdrom {{role_path}}/files/ubuntu20_04.iso \
|
||||
cmd: "qemu-system-x86_64 -cdrom {{playbook_dir}}/files/ubuntu20_04.iso \
|
||||
-enable-kvm -boot order=d \
|
||||
-drive file={{userdata}}/drive1,if=virtio,id=a,media=disk,format=qcow2 \
|
||||
-drive file={{userdata}}/drive2,if=virtio,id=b,media=disk,format=qcow2 \
|
||||
|
|
Loading…
Reference in New Issue