fixed variables in qemu

autoautoinstall
Daniel Liu 1 year ago
parent 884c437e7b
commit 1f966eedd0
  1. 2
      ansible.cfg
  2. 0
      group_vars/all.yml
  3. 10
      group_vars/local.yml
  4. 0
      group_vars/vm.yml
  5. 2
      hosts
  6. 7
      hosts.yml
  7. 14
      qemu/main.yml

@ -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

@ -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,7 +0,0 @@
all:
local:
hosts:
localhost:
vm:
hosts:
ubuntu@localhost:

@ -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…
Cancel
Save