-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
- Loading branch information
1 parent
da24b90
commit b4566c1
Showing
6 changed files
with
111 additions
and
107 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,4 @@ | |
namespace: "{{ vm.namespace }}" | ||
loop: "{{ molecule_yml.platforms }}" | ||
loop_control: | ||
loop_var: vm | ||
loop_var: vm |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,4 +42,4 @@ scenario: | |
- idempotence | ||
- side_effect | ||
- verify | ||
- destroy | ||
- destroy |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,59 @@ | ||
--- | ||
- name: Create VM in KubeVirt | ||
kubernetes.core.k8s: # Uses the k8s module from the kubernetes.core Ansible collection | ||
state: present # Ensures the VM exists. If it doesn't, it will be created. | ||
kubernetes.core.k8s: # Uses the k8s module from the kubernetes.core Ansible collection | ||
state: present # Ensures the VM exists. If it doesn't, it will be created. | ||
definition: | ||
apiVersion: kubevirt.io/v1 # KubeVirt's API version | ||
kind: VirtualMachine # The type of Kubernetes resource to create | ||
apiVersion: kubevirt.io/v1 # KubeVirt's API version | ||
kind: VirtualMachine # The type of Kubernetes resource to create | ||
metadata: | ||
labels: | ||
kubevirt.io/domain: "{{ vm.name }}" # Labels for the VM | ||
name: "{{ vm.name }}" # Name of the VM | ||
kubevirt.io/domain: "{{ vm.name }}" # Labels for the VM | ||
name: "{{ vm.name }}" # Name of the VM | ||
namespace: "{{ vm.namespace }}" # Namespace where the VM will be created | ||
spec: | ||
running: true # Starts the VM after creation | ||
template: | ||
metadata: | ||
labels: | ||
kubevirt.io/domain: "{{ vm.name }}" # Labels for the VM's template | ||
spec: | ||
domain: | ||
devices: | ||
disks: | ||
- disk: | ||
bus: virtio # Type of disk bus | ||
name: containerdisk # Name of the container disk | ||
- disk: | ||
bus: virtio # Type of disk bus | ||
name: cloudinitdisk # Name of the cloud-init disk | ||
- name: emptydisk # Name of the empty disk | ||
disk: | ||
bus: virtio # Type of disk bus | ||
resources: | ||
requests: | ||
memory: "{{ vm.memory | default('1Gi') }}" # Amount of memory requested for the VM | ||
volumes: | ||
- name: emptydisk | ||
emptyDisk: | ||
capacity: "{{ vm.capacity | default('2Gi') }}" # Capacity of the empty ephemeral disk | ||
- containerDisk: | ||
image: "{{ vm.image }}" # The image used for the container disk | ||
name: containerdisk | ||
- cloudInitNoCloud: # Cloud-init configuration | ||
userData: | # User-data script | ||
#cloud-config | ||
preserve_hostname: true | ||
hostname: "{{ vm.name }}" # Sets the hostname | ||
fqdn: "{{ vm.name }}" # Fully Qualified Domain Name | ||
prefer_fqdn_over_hostname: true | ||
users: | ||
- default | ||
- name: {{ vm.ansible_user }} | ||
lock_passwd: true # Locks the password | ||
ssh_authorized_keys: | ||
- "{{ temporary_ssh_public_key }}" # SSH public key | ||
runcmd: | ||
- [ sh, -c, "hostnamectl set-hostname {{ vm.name }}" ] # Sets the hostname | ||
- [ sudo, yum, install, -y, qemu-guest-agent ] # Installs qemu-guest-agent | ||
- [ sudo, systemctl, start, qemu-guest-agent ] # Starts qemu-guest-agent | ||
name: cloudinitdisk | ||
running: true # Starts the VM after creation | ||
template: | ||
metadata: | ||
labels: | ||
kubevirt.io/domain: "{{ vm.name }}" # Labels for the VM's template | ||
spec: | ||
domain: | ||
devices: | ||
disks: | ||
- disk: | ||
bus: virtio # Type of disk bus | ||
name: containerdisk # Name of the container disk | ||
- disk: | ||
bus: virtio # Type of disk bus | ||
name: cloudinitdisk # Name of the cloud-init disk | ||
- name: emptydisk # Name of the empty disk | ||
disk: | ||
bus: virtio # Type of disk bus | ||
resources: | ||
requests: | ||
memory: "{{ vm.memory | default('1Gi') }}" # Amount of memory requested for the VM | ||
volumes: | ||
- name: emptydisk | ||
emptyDisk: | ||
capacity: "{{ vm.capacity | default('2Gi') }}" # Capacity of the empty ephemeral disk | ||
- containerDisk: | ||
image: "{{ vm.image }}" # The image used for the container disk | ||
name: containerdisk | ||
- cloudInitNoCloud: # Cloud-init configuration | ||
userData: | # User-data script | ||
#cloud-config | ||
preserve_hostname: true | ||
hostname: "{{ vm.name }}" # Sets the hostname | ||
fqdn: "{{ vm.name }}" # Fully Qualified Domain Name | ||
prefer_fqdn_over_hostname: true | ||
users: | ||
- default | ||
- name: {{ vm.ansible_user }} | ||
lock_passwd: true # Locks the password | ||
ssh_authorized_keys: | ||
- "{{ temporary_ssh_public_key }}" # SSH public key | ||
runcmd: | ||
- [ sh, -c, "hostnamectl set-hostname {{ vm.name }}" ] # Sets the hostname | ||
- [ sudo, yum, install, -y, qemu-guest-agent ] # Installs qemu-guest-agent | ||
- [ sudo, systemctl, start, qemu-guest-agent ] # Starts qemu-guest-agent | ||
name: cloudinitdisk |
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