All Projects → virt-lightning → Virt Lightning

virt-lightning / Virt Lightning

Licence: apache-2.0
Starts your VM on libvirt in a couple of seconds!

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Virt Lightning

vagrant-travisci-libvrt
Example project showing how to run Vagrant on TravisCI using libvrt & KVM
Stars: ✭ 25 (-64.79%)
Mutual labels:  kvm, libvirt
yosild
Yosild is a single shell script that builds a full, minimal Linux distribution based on BusyBox.
Stars: ✭ 97 (+36.62%)
Mutual labels:  kvm, libvirt
evcloud
EVCloud是一个基于ceph和libvirt的轻量级云主机管理平台,实用稳定,维护简易
Stars: ✭ 44 (-38.03%)
Mutual labels:  kvm, libvirt
Ansible Kvm
Stars: ✭ 40 (-43.66%)
Mutual labels:  kvm, libvirt
halcyon-vagrant-kubernetes
Vagrant deployment mechanism for halcyon-kubernetes.
Stars: ✭ 12 (-83.1%)
Mutual labels:  kvm, libvirt
Kvm Install Vm
Bash script to build local virtual machines using KVM/libvirt and cloud-init.
Stars: ✭ 248 (+249.3%)
Mutual labels:  kvm, libvirt
lightstars
Makes it easier for you to control virtual resource.
Stars: ✭ 14 (-80.28%)
Mutual labels:  kvm, libvirt
Node Libvirt
libvirt bindings for google v8 javascript engine (nodejs addon)
Stars: ✭ 162 (+128.17%)
Mutual labels:  kvm, libvirt
virtnbdbackup
Backup utiliy for Libvirt / qemu / kvm supporting incremental and differencial backups.
Stars: ✭ 62 (-12.68%)
Mutual labels:  kvm, libvirt
md server
Standalone EC2 metadata server to simplify the user of vendor cloud images with standalone kvm/libvirt
Stars: ✭ 36 (-49.3%)
Mutual labels:  kvm, libvirt
Terraform Provider Libvirt
Terraform provider to provision infrastructure with Linux's KVM using libvirt
Stars: ✭ 894 (+1159.15%)
Mutual labels:  kvm, libvirt
Vmango
Your own personal IaaS cloud
Stars: ✭ 265 (+273.24%)
Mutual labels:  kvm, libvirt
Kimchi
An HTML5 management interface for KVM guests
Stars: ✭ 2,773 (+3805.63%)
Mutual labels:  kvm, libvirt
Ravada
Remote Virtual Desktops Manager
Stars: ✭ 253 (+256.34%)
Mutual labels:  kvm, libvirt
Virtlyst
Web interface to manage virtual machines with libvirt
Stars: ✭ 167 (+135.21%)
Mutual labels:  kvm, libvirt
vmdashboard
web-based open source virtualization management interface for QEMU and KVM virtual machines
Stars: ✭ 66 (-7.04%)
Mutual labels:  kvm, libvirt
Karesansui
Karesansui is an open-source virtualization management application made in Japan.
Stars: ✭ 97 (+36.62%)
Mutual labels:  kvm, libvirt
Terrible
An Ansible playbook that apply the principle of the Infrastructure as Code on a QEMU/KVM environment.
Stars: ✭ 161 (+126.76%)
Mutual labels:  kvm, libvirt
deploy-vm
Libvirt wrapper to spawn VMs using cloud images
Stars: ✭ 56 (-21.13%)
Mutual labels:  kvm, libvirt
gpu-passthrough
A GPU passthrough tutorial using libvirt and KVM on GNU/Linux
Stars: ✭ 57 (-19.72%)
Mutual labels:  kvm, libvirt

🗲 a CLI to start local Cloud image on libvirt!🗲

Build Status PyPI version

Logo

Virt-Lightning can quickly deploy a bunch of new VM. It also prepares the Ansible inventory file!

This is handy to quickly validate a new Ansible playbook, or a role on a large number of environments.

example: test an Ansible command on a new env in ONE minute ⚡

In a nutshell:

echo "- distro: centos-7" > virt-lightning.yaml
vl up
vl ansible_inventory
ansible all -m ping -i inventory

In the video below, we:

  1. use the list of distribution to generate a virt-lightning.yaml file.
  2. we then create a environment based on this file
  3. once the environment is ready, we generate an Ansible inventory file
  4. and we use it to call Ansible's ping module on all the host.

demo

Pre-requirements

  • The Python3 binding for libvirt, the package is probably called python3-libvirt.
  • You make also want to install python3-urwid if you want to get the fancy list of VM. This dependency is optional.
  • Libvirt must be running, most of the time you just need to run: sudo systemctl start --now libvirtd
  • Finally, be sure your user can access the system libvirt daemon, e.g with: virsh -c qemu:///system

Installation

pip3 install --user virt-lightning

If you use Ubuntu, you will need the --no-deps argument (See: https://github.com/pypa/pip/issues/4222).

virt-lightning will be installed in ~/.local/bin/. Add it in your $PATH if it's not already the case. For instance if you use:

echo "export PATH=$PATH:~/.local/bin/" >> ~/.bashrc
source ~/.bashrc

Fetch some images

Before you start your first VM, you need to fetch the images. To do so, you just use the vm fetch command:

$ vl fetch fedora-32

Actions

vl is an alias for virt-lightning, you can us both. In the rest of the document we use the shortest version.

vl distro_list

List the distro images that can be used. Its output is compatible with vl up. You can initialize a new configuration with: vl distro > virt-lightning.yaml.

vl up

virt-lightning will read the virt-lightning.yaml file from the current directory and prepare the associated VM.

vl down

Destroy all the VM managed by Virt-Lightning.

vl start

Start a specific VM, without reading the virt-lightning.yaml file.

vl stop

Stop just one VM.

vl status

List the VM, their IP and if they are reachable.

vl ansible_inventory

Export an inventory in the Ansible format.

vl ssh

Show up a menu to select a host and open a ssh connection.

vl ssh

vl console

Like vl ssh but with the serial console of the VM.

vl ssh

vl viewer

Like vl console but with the SPICE console of the VM. Requires virt-viewer.

vl fetch

Fetch a VM image. You can find here a list of the available images.

Configuration

Global configuration

If ~/.config/virt-lightning/config.ini exists, Virt-Lightning will read its configuration there.

[main]
network_name = virt-lightning
root_password = root
storage_pool = virt-lightning
network_auto_clean_up = True

network_name: if you want to use an alternative libvirt network

root_password: the root password

storage_pool: if you want to use an alternative libvirt storage pool

network_auto_clean_up: if you want to automatically remove a network when running virt-lightning down

VM configuration keys

A VM can be tunned at two different places with the following keys:

  • distro: the name of the base distro image to use, it's the only mandatory parameter.
  • name: the VM name
  • memory: the amount of memory to dedicate to the VM
  • root_disk_size: the size of the root disk in GB
  • vcpus: the number of vcpu to dedicate to the VM
  • root_password: the root password in clear text
  • groups: this list of groups will be used if you generate an Ansible inventory.
  • networks: a list of network to attach to the VM. The default is: one virtio interface attached to virt-lightning network.
    • network: the name of the network. Default is the key network_name from the configuration (virt-lightning by default)
    • ipv4: a static IPv4. Default is a dynamic IPv4 address.
    • nic_model: the libvirt driver to use. Default is virtio

Example: a virt-lightning.yaml file:

- name: esxi-vcenter
  distro: esxi-6.7
  memory: 12000
  root_disk_size: 30
  vcpus: 2
  root_password: '!234AaAa56'
  groups: ['all_esxi']
- name: esxi1
  distro: esxi-6.7
  memory: 4096
  vcpus: 1
  root_password: '!234AaAa56'
  groups: ['all_esxi', 'esxi_lab']
- name: esxi2
  distro: esxi-6.7
  memory: 4096
  vcpus: 1
  root_password: '!234AaAa56'
  groups: ['all_esxi', 'esxi_lab']
- name: centos-7
  distro: centos-7
  networks:
    - network: default
      ipv4: 192.168.122.50
  bootcmd:
    - yum update -y

You can also associate some parameters to the distro image itself

cat /var/lib/virt-lightning/pool/upstream/esxi-6.7.yaml
username: root
python_interpreter: /bin/python
memory: 4096
networks:
  - network: virt-lightning
    nic_model: virtio
  - network: default
    nic_model: e1000
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].