Ansible Role to automate common kubevirt tasks
Ansible 2.9 or higher
Red Hat OpenShift Container Platform or equivalent
Collections:
- kubernetes.core
- redhat.openshift
- community.general
Currently the following variables are supported:
What action to perform, currently the following actions are supported:
create
Create a virtual machine.
delete
Delete a virtual machine.
start
Start a virtual machine.
stop
Stop a virtual machine.
start_all
Starts all virtual machines in the cluster, can be used together with openshift_vm_namespace
to only start all virtual machines in a namespace.
stop_all
Stops all virtual machines in the cluster, can be used together with openshift_vm_namespace
to only stop all virtual machines in a namespace.
openshift_vm_action: create
Name of the virtual machine that should be created/deleted/modified.
openshift_vm_name: 'test-vm'
Name of the namespace/project that we should operate in.
openshift_vm_namespace: 'test-project'
None
Start a virtual machine:
- name: "Include role openshift_vm"
include_role:
name: openshift_vm
vars:
openshift_vm_action: start
openshift_vm_name: <vm_name>
openshift_vm_namespace: <project_name>
Start all virtual machines in a namespace:
- name: "Include role openshift_vm"
include_role:
name: openshift_vm
vars:
openshift_vm_action: start_all
openshift_vm_namespace: <project_name>
Start all virtual machines in the cluster:
- name: "Include role openshift_vm"
include_role:
name: openshift_vm
vars:
openshift_vm_action: start_all
Stop a virtual machine:
- name: "Include role openshift_vm"
include_role:
name: openshift_vm
vars:
openshift_vm_action: stop
openshift_vm_name: <vm_name>
openshift_vm_namespace: <project_name>
Stop all virtual machines in a namespace:
- name: "Include role openshift_vm"
include_role:
name: openshift_vm
vars:
openshift_vm_action: stop_all
openshift_vm_namespace: <project_name>
Stop all virtual machines in the cluster:
- name: "Include role openshift_vm"
include_role:
name: openshift_vm
vars:
openshift_vm_action: stop_all
GPLv2+
Peter Gustafsson pgustafs@redhat.com