Deploy your testing VM in a couple of sections
Project description
🗲 Ride the Lightning!🗲
Virt-Lightning can quickly deploy a bunch of new VM. It also prepares the Ansible inventory file!
This is really 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:
- use the list of distribution to generate a virt-lightning.yaml file.
- we then create a environment based on this file
- once the environment is ready, we generate an Ansible inventory file
- and we use it to call Ansible's ping module on all the host.
Pre-requirements
Debian
First you need to install libvirt and guestfs:
sudo apt install -f libguestfs-tools libvirt-daemon libvirt-daemon-system python3 python3-libvirt python3-pip python3-urwid
sudo systemctl start --now libvirtd
The second step is to grant to your user the ability to use libvirt:
sudo usermod -a -G kvm,libvirt,libvirt-qemu $USER
Fedora-29
First you need to install libvirt and guestfs:
sudo apt install -f libguestfs-tools libselinux-python libvirt python3 python3-libvirt python3-pip python3-urwid
sudo systemctl start --now libvirtd
The second step is to grant to your user the ability to use libvirt:
sudo usermod -a -G qemu,libvirt $USER
Ubuntu-16.04
First you need to install libvirt and guestfs:
sudo apt install -f libguestfs-tools libvirt-bin libvirt-daemon python3 python3-libvirt python3-pip python3-urwid
sudo systemctl start --now libvirtd
The second step is to grant to your user the ability to use libvirt:
sudo usermod -a -G kvm,libvirtd $USER
Ubuntu-18.04
First you need to install libvirt and guestfs:
sudo apt install -f libguestfs-tools libvirt-bin libvirt-daemon python3 python3-libvirt python3-pip python3-urwid
sudo systemctl start --now libvirtd
The second step is to grant to your user the ability to use libvirt:
sudo usermod -a -G kvm,libvirt $USER
Ubuntu-18.10
First you need to install libvirt and guestfs:
sudo apt install -f libguestfs-tools libvirt-daemon libvirt-daemon-system python3 python3-libvirt python3-pip python3-urwid
sudo systemctl start --now libvirtd
The second step is to grant to your user the ability to use libvirt:
sudo usermod -a -G kvm,libvirt $USER
Installation
pip3 install --user --no-deps git+https://github.com/virt-lightning/virt-lightning
The --no-deps
argument is only required on Ubuntu (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 need these scripts: https://github.com/virt-lightning/virt-lightning/tree/master/images
$ git clone https://github.com/virt-lightning/virt-lightning
$ cd virt-lightning/images
$ ./image centos-7 build
$ ./image debian-9 build
(…)
Ubuntu requires use sudo to build or prepare images.
You can also use your own images as soon as they embed cloud-init, just copy them in the QCOW2 format in /var/lib/virt-lightning/pool/upstream/. It's also a good idea to include qemu-guest-agent, virt-lightning uses it to set the root password and it offers some other benefits.
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 thevirt-lightning.yaml
file from the current directory and prepare the associated VM. - vl down: Destroy all the 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 console: Like
vl ssh
but with the serial console of the VM
Configuration from file
You can create your own configuration file like this and save to config.ini
[main]
network_name = virt-lightning
root_password = root
storage_pool = virt-lightning
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file virt-lightning-0.1.0.tar.gz
.
File metadata
- Download URL: virt-lightning-0.1.0.tar.gz
- Upload date:
- Size: 62.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
cbe823dabee286eceab58ccd69fb34062587ca1d86e9a66b61982e8d91146fb5
|
|
MD5 |
dd7d53357608d2beb9263e716dc1d06d
|
|
BLAKE2b-256 |
d820a8097ce3ed4b2e1e736efe11a7b2e413ec6c71fdb0f5468c2e5b2cf4ffe2
|