Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| add0a7f2c2 | |||
| e40d91eb16 | |||
| f6a3273e08 | |||
| 83edc85654 | |||
| 78695e9f1d | |||
| 71c67cb81a | |||
| f2c6da73df | |||
| fdd7ca8016 | |||
| 223b787675 | |||
| 4c52425591 | |||
| 03ced3d1b1 | |||
| 51fd19f45a |
@@ -5,9 +5,7 @@ This project provides an Ansible-based framework to automatically provision virt
|
|||||||
## 🚀 Features
|
## 🚀 Features
|
||||||
|
|
||||||
- **Automated Host Setup**: Installs and configures `libvirt`, `qemu-kvm`, and `libguestfs-tools`.
|
- **Automated Host Setup**: Installs and configures `libvirt`, `qemu-kvm`, and `libguestfs-tools`.
|
||||||
- **Immutable OS Support**: Handles the specific boot-time configuration requirements for:
|
- **Ignition Support**: Generates and injects Ignition configuration for all supported OSs via the `fw_cfg` QEMU feature.
|
||||||
- **CoreOS/Flatcar**: Generates and injects Ignition JSON configurations.
|
|
||||||
- **MicroOS**: Generates and injects Cloud-init user-data.
|
|
||||||
- **Custom User Provisioning**: Automatically creates a default user with a hashed password and injects your SSH public key.
|
- **Custom User Provisioning**: Automatically creates a default user with a hashed password and injects your SSH public key.
|
||||||
- **Modular Design**: Uses Ansible roles for host preparation, configuration generation, and VM provisioning.
|
- **Modular Design**: Uses Ansible roles for host preparation, configuration generation, and VM provisioning.
|
||||||
|
|
||||||
@@ -22,7 +20,7 @@ ansible-kvm-vms/
|
|||||||
│ └── vms.yml # List of VMs to create with CPU, RAM, and Disk specs
|
│ └── vms.yml # List of VMs to create with CPU, RAM, and Disk specs
|
||||||
├── roles/
|
├── roles/
|
||||||
│ ├── kvm_host_setup/ # Installs virtualization dependencies on the host
|
│ ├── kvm_host_setup/ # Installs virtualization dependencies on the host
|
||||||
│ ├── os_config/ # Generates Ignition/Cloud-init config files
|
│ ├── os_config/ # Generates Ignition configuration files
|
||||||
│ └── vm_provision/ # Downloads images and creates VMs via virt-install
|
│ └── vm_provision/ # Downloads images and creates VMs via virt-install
|
||||||
└── playbooks/
|
└── playbooks/
|
||||||
└── create_vms.yml # Main orchestration playbook
|
└── create_vms.yml # Main orchestration playbook
|
||||||
@@ -67,9 +65,8 @@ Edit `vars/vms.yml` to add or modify the VMs you wish to deploy. You can specify
|
|||||||
## 🔍 How it Works
|
## 🔍 How it Works
|
||||||
|
|
||||||
Since immutable OSs do not use traditional installers, this setup uses a "seed" approach:
|
Since immutable OSs do not use traditional installers, this setup uses a "seed" approach:
|
||||||
1. **Config Generation**: The `os_config` role creates a JSON (Ignition) or YAML (Cloud-init) file based on your variables.
|
1. **Config Generation**: The `os_config` role creates a JSON Ignition configuration file based on your variables.
|
||||||
2. **Image Customization**: The `vm_provision` role downloads the official `.qcow2` cloud image and uses `virt-customize` (from `libguestfs-tools`) to inject the configuration directly into the disk image before the VM is started.
|
2. **Deployment**: `virt-install` is used to create the VM with UEFI boot. The `--sysinfo` flag is used to provide the Ignition config via the `fw_cfg` device, which the immutable OSs (CoreOS, Flatcar, MicroOS) process at first boot.
|
||||||
3. **Deployment**: `virt-install` is used to create the VM with UEFI boot and the customized disk.
|
|
||||||
|
|
||||||
## 🌐 Accessing your VMs
|
## 🌐 Accessing your VMs
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# VM names from vars/vms.yml
|
|
||||||
VMS=("coreos-vm" "flatcar-vm" "microos-vm")
|
|
||||||
# Image directory from group_vars/all.yml
|
|
||||||
IMAGES_DIR="/var/lib/libvirt/images"
|
|
||||||
|
|
||||||
for vm in "${VMS[@]}"; do
|
|
||||||
echo "Cleaning up VM: $vm"
|
|
||||||
|
|
||||||
# Destroy the VM (force stop)
|
|
||||||
sudo virsh destroy "$vm" 2>/dev/null || echo "VM $vm is not running."
|
|
||||||
|
|
||||||
# Undefine the VM (remove configuration)
|
|
||||||
sudo virsh undefine "$vm" 2>/dev/null || echo "VM $vm is not defined."
|
|
||||||
|
|
||||||
# Remove the disk image
|
|
||||||
sudo rm -f "$IMAGES_DIR/$vm.qcow2"
|
|
||||||
sudo rm -f "$IMAGES_DIR/$vm.download"
|
|
||||||
|
|
||||||
echo "VM $vm cleaned up."
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Cleanup complete."
|
|
||||||
@@ -7,7 +7,7 @@ vm_ssh_public_key: "~/.ssh/id_vms.pub" # Path to your public key for SSH access
|
|||||||
# Default VM resources
|
# Default VM resources
|
||||||
default_cpu: 2
|
default_cpu: 2
|
||||||
default_ram: 2048
|
default_ram: 2048
|
||||||
default_disk: 20 # GB
|
default_disk: "20G"
|
||||||
|
|
||||||
# Storage path for images
|
# Storage path for images
|
||||||
vm_images_dir: "/var/lib/libvirt/images"
|
vm_images_dir: "/var/lib/libvirt/images"
|
||||||
|
|||||||
@@ -27,4 +27,6 @@
|
|||||||
cpu: "{{ item.cpu }}"
|
cpu: "{{ item.cpu }}"
|
||||||
ram: "{{ item.ram }}"
|
ram: "{{ item.ram }}"
|
||||||
disk: "{{ item.disk }}"
|
disk: "{{ item.disk }}"
|
||||||
|
disk_bus: "{{ item.disk_bus }}"
|
||||||
loop: "{{ vms }}"
|
loop: "{{ vms }}"
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: Generate Butane config for CoreOS
|
- name: Generate Ignition config
|
||||||
template:
|
template:
|
||||||
src: coreos_ignition.bu.j2
|
src: ignition.json.j2
|
||||||
dest: "/tmp/{{ vm_name }}.bu"
|
dest: "/tmp/{{ vm_name }}.ign"
|
||||||
when: os_type == 'coreos'
|
|
||||||
|
|
||||||
- name: Generate Butane config for Flatcar
|
|
||||||
template:
|
|
||||||
src: flatcar_ignition.bu.j2
|
|
||||||
dest: "/tmp/{{ vm_name }}.bu"
|
|
||||||
when: os_type == 'flatcar'
|
|
||||||
|
|
||||||
- name: Generate Butane config for microos
|
|
||||||
template:
|
|
||||||
src: microos_ignition.bu.j2
|
|
||||||
dest: "/tmp/{{ vm_name }}.bu"
|
|
||||||
when: os_type == 'microos'
|
|
||||||
|
|
||||||
- name: Compile Butane to Ignition JSON
|
|
||||||
shell: |
|
|
||||||
docker run --rm -i quay.io/coreos/butane --pretty --strict < /tmp/{{ vm_name }}.bu > {{ vm_images_dir }}/{{ vm_name }}.ign
|
|
||||||
become: yes
|
|
||||||
|
|
||||||
- name: Generate dummy meta-data file
|
|
||||||
copy:
|
|
||||||
content: "instance-id: {{ vm_name }}\nlocal-hostname: {{ vm_name }}\n"
|
|
||||||
dest: "{{ vm_images_dir }}/{{ vm_name }}_meta-data"
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
variant: fcos
|
|
||||||
version: 1.5.0
|
|
||||||
passwd:
|
|
||||||
users:
|
|
||||||
- name: {{ vm_user }}
|
|
||||||
password_hash: "{{ vm_password | password_hash('sha512') }}"
|
|
||||||
ssh_authorized_keys:
|
|
||||||
- "{{ lookup('file', vm_ssh_public_key) | trim }}"
|
|
||||||
storage:
|
|
||||||
files:
|
|
||||||
- path: /etc/ssh/sshd_config.d/permit_root_login.conf
|
|
||||||
mode: 0644
|
|
||||||
contents:
|
|
||||||
inline: PermitRootLogin yes
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
variant: fcos
|
|
||||||
version: 1.4.0
|
|
||||||
passwd:
|
|
||||||
users:
|
|
||||||
- name: {{ vm_user }}
|
|
||||||
password_hash: "{{ vm_password | password_hash('sha512') }}"
|
|
||||||
ssh_authorized_keys:
|
|
||||||
- "{{ lookup('file', vm_ssh_public_key) | trim }}"
|
|
||||||
storage:
|
|
||||||
files:
|
|
||||||
- path: /etc/ssh/sshd_config.d/permit_root_login.conf
|
|
||||||
mode: 0644
|
|
||||||
contents:
|
|
||||||
inline: PermitRootLogin yes
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"ignition": {
|
||||||
|
"version": "3.0.0"
|
||||||
|
},
|
||||||
|
"passwd": {
|
||||||
|
"users": [
|
||||||
|
{
|
||||||
|
"name": "{{ vm_user }}",
|
||||||
|
"sshAuthorizedKeys": [
|
||||||
|
"{{ lookup('file', vm_ssh_public_key | replace('~', lookup('env', 'HOME'))) }}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
variant: fcos
|
|
||||||
version: 1.5.0
|
|
||||||
passwd:
|
|
||||||
users:
|
|
||||||
- name: root
|
|
||||||
password_hash: "{{ vm_password | password_hash('sha512') }}"
|
|
||||||
ssh_authorized_keys:
|
|
||||||
- "{{ lookup('file', vm_ssh_public_key) | trim }}"
|
|
||||||
storage:
|
|
||||||
disks:
|
|
||||||
- device: /dev/vdb
|
|
||||||
wipe_table: true
|
|
||||||
partitions:
|
|
||||||
- label: ext-data
|
|
||||||
number: 1
|
|
||||||
filesystems:
|
|
||||||
- device: /dev/vdb1
|
|
||||||
format: btrfs
|
|
||||||
label: ext-pool
|
|
||||||
wipe_filesystem: true
|
|
||||||
files:
|
|
||||||
- path: /etc/ssh/sshd_config.d/permit_root_login.conf
|
|
||||||
mode: 0644
|
|
||||||
contents:
|
|
||||||
inline: PermitRootLogin yes
|
|
||||||
systemd:
|
|
||||||
units:
|
|
||||||
# 1. Einmaliger Dienst, der das Subvolume "@home" physisch auf der Platte anlegt
|
|
||||||
- name: create-home-subvolume.service
|
|
||||||
enabled: true
|
|
||||||
contents: |
|
|
||||||
[Unit]
|
|
||||||
Description=Create Btrfs Subvolume for Home (Once)
|
|
||||||
After=local-fs-pre.target
|
|
||||||
Before=home.mount
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStartPre=/usr/bin/mkdir -p /run/mnt-ext-init
|
|
||||||
ExecStartPre=/usr/bin/mount LABEL=ext-pool /run/mnt-ext-init
|
|
||||||
# Hier werden die Subvolumes @home angelegt, falls sie nicht existieren
|
|
||||||
ExecStart=/usr/bin/bash -c "for sub in @home; do [ -d /run/mnt-ext-init/\$$sub ] || /usr/sbin/btrfs subvolume create /run/mnt-ext-init/$$sub; done"
|
|
||||||
ExecStartPost=/usr/bin/umount /run/mnt-ext-init
|
|
||||||
ExecStartPost=/usr/bin/rmdir /run/mnt-ext-init
|
|
||||||
RemainAfterExit=true
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
RequiredBy=home.mount
|
|
||||||
# Der Name der Unit MUSS exakt dem Pfad entsprechen (aus /home wird home.mount)
|
|
||||||
- name: home.mount
|
|
||||||
enabled: true
|
|
||||||
contents: |
|
|
||||||
[Unit]
|
|
||||||
Description=Mount Separates Home Laufwerk
|
|
||||||
Before=local-fs.target
|
|
||||||
|
|
||||||
[Mount]
|
|
||||||
What=LABEL=ext-pool
|
|
||||||
Where=/home
|
|
||||||
Type=btrfs
|
|
||||||
Options=defaults,subvol=@home
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=local-fs.target
|
|
||||||
# HIER wird der zusätzliche User sicher angelegt, NACHDEM /home gemountet ist
|
|
||||||
- name: create-custom-users.service
|
|
||||||
enabled: true
|
|
||||||
contents: |
|
|
||||||
[Unit]
|
|
||||||
Description=Create Additional System Users safely after Mounts
|
|
||||||
After=home.mount
|
|
||||||
Requires=home.mount
|
|
||||||
Before=multi-user.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
# Legt den User an, setzt das Home-Verzeichnis, fügt ihn zu wheel (sudo) hinzu und setzt den SSH Key
|
|
||||||
ExecStart=/usr/bin/bash -c "\
|
|
||||||
/usr/sbin/useradd -m -s /bin/bash {{ vm_user }} && \
|
|
||||||
/usr/sbin/usermod -p '{{ vm_password | password_hash('sha512') }}' {{ vm_user }} && \
|
|
||||||
/usr/bin/mkdir -p /home/{{ vm_user }}/.ssh && \
|
|
||||||
/usr/bin/echo '{{ lookup('file', vm_ssh_public_key) | trim }}' > /home/{{ vm_user }}/.ssh/authorized_keys && \
|
|
||||||
/usr/bin/chown -R {{ vm_user }}:{{ vm_user }} /home/{{ vm_user }}/.ssh && \
|
|
||||||
/usr/bin/chmod 700 /home/{{ vm_user }}/.ssh && \
|
|
||||||
/usr/bin/chmod 600 /home/{{ vm_user }}/.ssh/authorized_keys"
|
|
||||||
RemainAfterExit=true
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
#cloud-config
|
||||||
|
users:
|
||||||
|
- name: {{ vm_user }}
|
||||||
|
passwd: {{ vm_password | password_hash('sha512') }}
|
||||||
|
ssh_authorized_keys:
|
||||||
|
- {{ lookup('file', vm_ssh_public_key | replace('~', lookup('env', 'HOME'))) }}
|
||||||
|
sudo: ALL=(ALL) NOPASSWD:ALL
|
||||||
|
write_files:
|
||||||
|
- path: /etc/ssh/sshd_config.d/permit_root_login.conf
|
||||||
|
content: |
|
||||||
|
PermitRootLogin yes
|
||||||
@@ -1,19 +1,7 @@
|
|||||||
#cloud-config
|
#cloud-config
|
||||||
users:
|
users:
|
||||||
- name: {{ vm_user }}
|
- name: {{ vm_user }}
|
||||||
passwd: {{ vm_password | password_hash('sha512') }}
|
sudo: ALL=(ALL) NOPASSWD:ALL
|
||||||
ssh_authorized_keys:
|
ssh_authorized_keys:
|
||||||
- {{ lookup('file', vm_ssh_public_key) | trim }}
|
- {{ lookup('file', vm_ssh_public_key | replace('~', lookup('env', 'HOME'))) }}
|
||||||
sudo: ALL=(ALL) NOPASSWD:ALL
|
|
||||||
lock_passwd: false
|
lock_passwd: false
|
||||||
- name: root
|
|
||||||
passwd: {{ vm_password | password_hash('sha512') }}
|
|
||||||
sudo: ALL=(ALL) NOPASSWD:ALL
|
|
||||||
lock_passwd: false
|
|
||||||
|
|
||||||
runcmd:
|
|
||||||
- mkdir -p /etc/ssh/sshd_config.d
|
|
||||||
- echo "PermitRootLogin yes" > /etc/ssh/sshd_config.d/permit_root_login.conf
|
|
||||||
- systemctl restart sshd
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: Define image URLs
|
- name: Define image URLs
|
||||||
set_fact:
|
set_fact:
|
||||||
os_images:
|
os_images:
|
||||||
coreos: "https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/44.20260510.3.1/x86_64/fedora-coreos-44.20260510.3.1-qemu.x86_64.qcow2.xz"
|
coreos: "https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/44.20260510.3.1/x86_64/fedora-coreos-44.20260510.3.1-qemu.x86_64.qcow2.xz"
|
||||||
flatcar: "https://stable.release.flatcar-linux.net/amd64-usr/current/flatcar_production_qemu_image.img"
|
flatcar: "https://stable.release.flatcar-linux.net/amd64-usr/current/flatcar_production_qemu_uefi_image.img"
|
||||||
microos: "https://download.opensuse.org/tumbleweed/appliances/openSUSE-MicroOS.x86_64-ContainerHost-kvm-and-xen.qcow2"
|
microos: "https://ftp.halifax.rwth-aachen.de/opensuse/tumbleweed/appliances/openSUSE-MicroOS.x86_64-kvm-and-xen.qcow2"
|
||||||
|
|
||||||
- name: Verify internet connectivity
|
- name: Verify internet connectivity
|
||||||
uri:
|
uri:
|
||||||
@@ -22,67 +23,50 @@
|
|||||||
- name: Handle compressed or raw images
|
- name: Handle compressed or raw images
|
||||||
shell: |
|
shell: |
|
||||||
DOWNLOAD_FILE="{{ vm_images_dir }}/{{ vm_name }}.download"
|
DOWNLOAD_FILE="{{ vm_images_dir }}/{{ vm_name }}.download"
|
||||||
FINAL_FILE="{{ vm_images_dir }}/{{ vm_name }}"
|
FINAL_FILE="{{ vm_images_dir }}/{{ vm_name }}.qcow2"
|
||||||
|
|
||||||
# 1. Handle XZ compression
|
# 1. Handle XZ compression
|
||||||
if [[ "{{ os_images[os_type] }}" == *.xz ]]; then
|
if [[ "{{ os_images[os_type] }}" == *.xz ]]; then
|
||||||
echo "Decompressing XZ image..."
|
echo "Decompressing XZ image..."
|
||||||
unxz -c "$DOWNLOAD_FILE" > "$FINAL_FILE".qcow2
|
unxz -c "$DOWNLOAD_FILE" > "$FINAL_FILE"
|
||||||
elif [[ "{{ os_images[os_type] }}" == *.img ]]; then
|
elif [[ "{{ os_images[os_type] }}" == *.img ]]; then
|
||||||
echo "Moving IMG image to final destination..."
|
echo "Converting RAW image to QCOW2..."
|
||||||
mv "$DOWNLOAD_FILE" "$FINAL_FILE".img
|
qemu-img convert -f raw -O qcow2 "$DOWNLOAD_FILE" "$FINAL_FILE"
|
||||||
else
|
else
|
||||||
echo "Moving QCOW2 image to final destination..."
|
echo "Moving QCOW2 image to final destination..."
|
||||||
mv "$DOWNLOAD_FILE" "$FINAL_FILE".qcow2
|
mv "$DOWNLOAD_FILE" "$FINAL_FILE"
|
||||||
fi
|
fi
|
||||||
rm -f "$DOWNLOAD_FILE"
|
rm -f "$DOWNLOAD_FILE"
|
||||||
become: yes
|
become: yes
|
||||||
args:
|
args:
|
||||||
creates: "{{ vm_images_dir }}/{{ vm_name }}.qcow2"
|
creates: "{{ vm_images_dir }}/{{ vm_name }}.qcow2"
|
||||||
|
|
||||||
|
- name: Debug Provisioning Vars
|
||||||
|
debug:
|
||||||
|
msg: "Provisioning {{ vm_name }} with disk_bus={{ disk_bus | default('virtio') }} and os_variant={{ os_variant }}"
|
||||||
|
|
||||||
|
- name: Remove existing VM definition
|
||||||
|
shell: |
|
||||||
|
virsh destroy {{ vm_name }} || true
|
||||||
|
virsh undefine {{ vm_name }} --nvram || true
|
||||||
|
rm -f /etc/libvirt/qemu/{{ vm_name }}.xml
|
||||||
|
become: yes
|
||||||
|
|
||||||
- name: Provision VM using virt-install
|
- name: Provision VM using virt-install
|
||||||
shell: |
|
shell: |
|
||||||
{% if os_type == 'coreos' %}
|
|
||||||
virt-install \
|
virt-install \
|
||||||
--connect qemu:///system \
|
|
||||||
--name {{ vm_name }} \
|
--name {{ vm_name }} \
|
||||||
--vcpus {{ cpu | default(default_cpu) }} \
|
--vcpus {{ cpu | default(default_cpu) }} \
|
||||||
--memory {{ ram | default(default_ram) }} \
|
--memory {{ ram | default(default_ram) }} \
|
||||||
--disk size={{ disk | default('10') }},backing_store={{ vm_images_dir }}/{{ vm_name }}.qcow2,backing_format=qcow2,bus=virtio \
|
--machine q35 \
|
||||||
--os-variant {{ os_variant }} \
|
--disk path={{ vm_images_dir }}/{{ vm_name }}.qcow2,bus={{ disk_bus | default('virtio') }} \
|
||||||
--network network=default \
|
|
||||||
--graphics none \
|
|
||||||
--noautoconsole \
|
|
||||||
--boot uefi \
|
|
||||||
--sysinfo type=fwcfg,entry0.name=opt/com.coreos/config,entry0.file={{ vm_images_dir }}/{{ vm_name }}.ign
|
|
||||||
{% elif os_type == 'flatcar' %}
|
|
||||||
virt-install \
|
|
||||||
--connect qemu:///system \
|
|
||||||
--name {{ vm_name }} \
|
|
||||||
--vcpus {{ cpu | default(default_cpu) }} \
|
|
||||||
--memory {{ ram | default(default_ram) }} \
|
|
||||||
--disk path={{ vm_images_dir }}/{{ vm_name }}.img,format=qcow2,bus=virtio \
|
|
||||||
--import \
|
--import \
|
||||||
--os-variant {{ os_variant }} \
|
--os-variant {{ os_variant }} \
|
||||||
--network network=default \
|
--network network=default \
|
||||||
--graphics none \
|
--graphics none \
|
||||||
--noautoconsole \
|
--noautoconsole \
|
||||||
--sysinfo system.serial=flatcar.first_boot=1 \
|
|
||||||
--qemu-commandline="-fw_cfg name=opt/org.flatcar-linux/config,file=/{{ vm_images_dir }}/{{ vm_name }}.ign"
|
|
||||||
{% elif os_type == 'microos' %}
|
|
||||||
virt-install \
|
|
||||||
--connect qemu:///system \
|
|
||||||
--name {{ vm_name }} \
|
|
||||||
--vcpus {{ cpu | default(default_cpu) }} \
|
|
||||||
--memory {{ ram | default(default_ram) }} \
|
|
||||||
--disk size={{ disk | default('10') }},backing_store={{ vm_images_dir }}/{{ vm_name }}.qcow2,backing_format=qcow2,bus=virtio \
|
|
||||||
--disk size={{ disk | default('10') }},path={{ vm_images_dir }}/{{ vm_name }}-home.qcow2,bus=virtio \
|
|
||||||
--os-variant {{ os_variant }} \
|
|
||||||
--network network=default \
|
|
||||||
--graphics none \
|
|
||||||
--noautoconsole \
|
|
||||||
--boot uefi \
|
--boot uefi \
|
||||||
--sysinfo type=fwcfg,entry0.name=opt/com.coreos/config,entry0.file={{ vm_images_dir }}/{{ vm_name }}.ign
|
--sysinfo type=fwcfg,entry0.name="opt/com.coreos/config",entry0.file="/tmp/{{ vm_name }}.ign"
|
||||||
{% endif %}
|
|
||||||
args:
|
args:
|
||||||
creates: "/etc/libvirt/qemu/{{ vm_name }}.xml"
|
creates: "/etc/libvirt/qemu/{{ vm_name }}.xml"
|
||||||
|
become: yes
|
||||||
|
|||||||
@@ -3,20 +3,23 @@ vms:
|
|||||||
- name: coreos-vm
|
- name: coreos-vm
|
||||||
os_type: coreos
|
os_type: coreos
|
||||||
os_variant: "fedora-coreos-stable"
|
os_variant: "fedora-coreos-stable"
|
||||||
|
disk_bus: "virtio"
|
||||||
cpu: 2
|
cpu: 2
|
||||||
ram: 2048
|
ram: 2048
|
||||||
disk: 20 # GB
|
disk: "20G"
|
||||||
|
|
||||||
- name: flatcar-vm
|
- name: flatcar-vm
|
||||||
os_type: flatcar
|
os_type: flatcar
|
||||||
os_variant: "fedora-coreos-stable"
|
os_variant: "fedora-coreos-stable"
|
||||||
|
disk_bus: "virtio"
|
||||||
cpu: 2
|
cpu: 2
|
||||||
ram: 2048
|
ram: 2048
|
||||||
disk: 20 # GB
|
disk: "20G"
|
||||||
|
|
||||||
- name: microos-vm
|
- name: microos-vm
|
||||||
os_type: microos
|
os_type: microos
|
||||||
os_variant: "opensusetumbleweed"
|
os_variant: "generic"
|
||||||
|
disk_bus: "virtio"
|
||||||
cpu: 2
|
cpu: 2
|
||||||
ram: 2048
|
ram: 2048
|
||||||
disk: 20 #GB
|
disk: "20G"
|
||||||
|
|||||||
Reference in New Issue
Block a user