-
Notifications
You must be signed in to change notification settings - Fork 199
/
install.yml
101 lines (99 loc) · 3.23 KB
/
install.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
---
- name: Deploy OpenShift CNV Operator and create the Hyperconverged object, provision VM to prove funciontality
hosts: localhost
gather_facts: false
vars:
vm_name: ocpvtest
vm_namespace: openshift-cnv
tasks:
- name: Include role
ansible.builtin.include_role:
name: demo.openshift.cluster_config
- name: Attempt to Provision a VM
kubernetes.core.k8s:
wait: true
state: "{{ instance_state | default('present') }}"
definition:
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: "{{ vm_name }}"
namespace: "{{ vm_namespace }}"
labels:
app: "{{ vm_name }}"
vm.kubevirt.io/name: "{{ vm_name }}"
spec:
dataVolumeTemplates:
- apiVersion: cdi.kubevirt.io/v1beta1
kind: DataVolume
metadata:
creationTimestamp: null
name: "{{ vm_name }}"
spec:
sourceRef:
kind: DataSource
name: "{{ os_version | default('fedora') }}"
namespace: openshift-virtualization-os-images
storage:
resources:
requests:
storage: 30Gi
running: true
template:
metadata:
annotations:
vm.kubevirt.io/flavor: small
vm.kubevirt.io/os: "{{ os_version | default('fedora') }}"
vm.kubevirt.io/workload: server
creationTimestamp: null
labels:
kubevirt.io/domain: "{{ vm_name }}"
kubevirt.io/size: small
spec:
domain:
cpu:
cores: 4
sockets: 1
threads: 1
devices:
disks:
- disk:
bus: virtio
name: rootdisk
interfaces:
- masquerade: {}
model: virtio
name: default
networkInterfaceMultiqueue: true
rng: {}
machine:
type: pc-q35-rhel9.2.0
resources:
requests:
memory: 8Gi
evictionStrategy: LiveMigrate
networks:
- name: default
pod: {}
terminationGracePeriodSeconds: 180
volumes:
- dataVolume:
name: "{{ vm_name }}"
name: rootdisk
retries: 60
delay: 5
register: provision
until: provision.changed
- name: Clean up test VM
kubernetes.core.k8s:
wait: true
state: absent
definition:
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: "{{ vm_name }}"
namespace: "{{ vm_namespace }}"
labels:
app: "{{ vm_name }}"
vm.kubevirt.io/name: "{{ vm_name }}"