-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path07_openshift-template.yaml
More file actions
33 lines (29 loc) · 958 Bytes
/
07_openshift-template.yaml
File metadata and controls
33 lines (29 loc) · 958 Bytes
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
---
- name: Create VM from OpenShift Template
hosts: localhost
connection: local
gather_facts: false
vars:
kubeconfig_path: "/root/ocp4/auth/kubeconfig"
namespace: "rhce-consulting-vms"
vm_name: "rhel9-vm"
memory: "4Gi"
cpu_cores: "2"
container_image: "registry.redhat.io/rhel9/rhel-guest-image:latest"
template_name: "rhel9-stable-template" # Name of the template deployed in the cluster
tasks:
- name: Process VM Template
command: >
oc process {{ template_name }}
-p VM_NAME={{ vm_name }}
-p NAMESPACE={{ namespace }}
-p MEMORY={{ memory }}
-p CPU_CORES={{ cpu_cores }}
-p CONTAINER_IMAGE={{ container_image }}
--kubeconfig={{ kubeconfig_path }}
register: processed_vm
- name: Apply the VM manifest
k8s:
kubeconfig: "{{ kubeconfig_path }}"
state: present
definition: "{{ processed_vm.stdout | from_yaml }}"