Giter Site home page Giter Site logo

kvm-os-launcher's Introduction

KVM OS Launcher

version 0.3

Prerequisites
  1. Python3

  2. The virtualization package group

  3. A KVM OS image to be used as template, placed in /var/lib/libvirt/images/templates.

  4. A configuration file, samples are provided in the ./conf directory.

Procedure
  1. Run the executable, with root privileges, followed by a configuration file name, followed by an integer (10 - 200 inclusive). For example:

    [rheslop@rsys kvm-os-launcher]$ sudo ./spawn.py --config rhel-8-large --id 15

A virtual machine is created then created with the following attributes:

  • The root’s SSH key is copied into the VM

  • If you login as root from a non-root account, the default password is 'password'.

  • The IP addresses are the first three octets specified by the NETWORK and NETWORK_2 variables. The last octet is the user-provided id. For example, the command ./spawn.py --config rhel-8-large --id 15 creates a VM with an IP address of 10.10.10.15, if you keep the default values.

  • The hostnames are set to the configuration name followed by the id. For example, the command ./spawn.py --config rhel-8-large --id 15, creates a VM with the hostname rhel-8-large-15.

  • The domain name is set to the value of the NETWORK_NAME_2 variable, plus '.local'. This behavior can be changed from within the template.

  • The eth0 inteface is for management, and routes by default. The eth1 is for services, and does not route.

    • You can use nmcli to modify routing once the VM starts. For example, to make eth0 non-routing, and eth1 routing:

      nmcli con mod eth0 ipv4.gateway ""
      nmcli con mod eth1 ipv4.gateway "172.16.16.1"
      nmcli con up eth0
      nmcli con up eth1
Template Variables

It best to copy a sample configuration file and modify rather than attempt to create one from scratch. For your reference, many of the variables used are provided below.

Variable Required Value

ID

yes

Must be set to $2

VCPUS

yes

The number of virtual CPUs you create the VM with.

MEMORY

yes

Enter the value in megabytes.

DISK_SIZE

yes

Enter the value in gigabytes with a trailing 'G'. Example 100G.

DISK_EXPAND_PART

no

Set to the partition path within the virtual machine to match which partition to expand to the provided DISK_SIZE. The default value is /dev/sda1 if not defined.

NETWORK_NAME

yes

The name of a KVM network. It is created if it does not yet exist. It is also the domainname of the VM you create. For example, a VM created with ./spawn.py --config rhel-8-large --id 15, and a NETWORK_NAME of kvm-os-net-1, will have an FQDN of rhel-8-large.kvm-os-net-1.local.

NETWORK

yes

The first three octets of a network address, and should not conflict with an existing KVM network.

NETWORK_NAME_2

yes

The name of a second KVM network. It is created if it does not yet exist.

NETWORK_2

yes

The first three octets of a network address, and should not conflict with an existing VKM network.

NAME

yes

Both the hostname and KVM virtual machine name. The recommended standard is the name of the configuration file with ${ID} appended. For example: rhel-8-large-${ID}

DISK

yes

The recommended standard is /var/lib/libvirt/images/${NAME}.qcow2.

TEMPLATE

yes

The full path to a QCOW2 image that you’ve downloaded.

OS_VARIANT

no

Set to define the value passed to the --os-variant flag for the virt-install application. The default value is linux2022. You can view available OS variants by running osinfo-query os.

kvm-os-launcher's People

Contributors

rheslop avatar leifmadsen avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Forkers

leifmadsen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.