Last active
November 16, 2022 10:28
-
-
Save fabiand/0abd60082dec2b144d13d203dae0e62b to your computer and use it in GitHub Desktop.
Ansible Playbook for KubeVirt VM with InstanceTypes and Prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# JUST TO BRAINSTORM | |
- name: Create a VM object from an inline definition | |
vm.kubevirt.io: | |
state: present | |
name: my-vm | |
namespace: my-namespace | |
spec: | |
instancetype: | |
name: clarge | |
running: true | |
template: | |
networks: | |
- multus: | |
networkName: blue | |
volumes: | |
- containerDisk: | |
image: registry:5000/kubevirt/cirros-container-disk-demo:devel | |
- cloudInitNoCloud: | |
userData: | | |
#!/bin/sh | |
echo 'printed from cloud-init userdata' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://docs.ansible.com/ansible/latest/collections/kubernetes/core/k8s_module.html | |
# https://github.com/kubevirt/kubevirt/blob/main/examples/vm-cirros-clarge-virtio.yaml | |
# | |
# ansible-playbook -i inventory.yaml playbook.yaml | |
- name: Create a VM object from an inline definition | |
kubernetes.core.k8s: | |
state: present | |
api_version: kubevirt.io/v1 | |
kind: VirtualMachine | |
name: my-vm | |
namespace: my-namespace | |
definition: | |
spec: | |
instancetype: | |
name: clarge | |
preference: # Will go away in future as well | |
name: virtio | |
running: true | |
template: | |
networks: | |
- name: blue | |
multus: | |
networkName: blue | |
volumes: | |
- containerDisk: | |
image: registry:5000/kubevirt/cirros-container-disk-demo:devel | |
name: root | |
- cloudInitNoCloud: | |
userData: | | |
#!/bin/sh | |
echo 'printed from cloud-init userdata' | |
name: cloudinit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment