summaryrefslogtreecommitdiff
path: root/README.md
blob: 9408291bfb29f5c2dc881611c3e6c7e73456fc68 (plain)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# vmadm README

vmadm is a tool to create and destroy virtual machines running
under a local libvirt. Virtual machines are described in specification
files, using YAML:

~~~yaml
foo:
  cpus: 4
  memory_mib: 4096
  image_size_gib: 100

bar:
  cpus: 1
  memory_mib: 512
  image_size_gib: 1
~~~

All the machines in a specification file are created or destroyed at
once.

## Usage

Given a specification file `machines.yaml`, to create virtual machines
run:

~~~sh
$ vmadm new machines.yaml
~~~

To delete them:

~~~sh
$ vmadm delete machines.yaml
~~~

Creating a VM creates a disk image of qcow2 format, based on a base
image, also of qcow2 format. Deleting the VM deletes the image file as
well. Image files are named after the VM and put into the configured
image directory, unless the specification file names an image file
explicitly.

To get built-in command line help:

~~~sh
$ vmadm help
$ vmadm --help
~~~

## Configuration

The default configuration file is `vmadm/config.yaml` under the XDG
configuration directory; by default, this is
`~/.config/vmadm/config.yaml`. The configuration file may specify the
following fields:

* `default_base_image` – path to the base image to use by default
* `default_image_gib` – default size of new image for a VM, in GiB
* `default_memory_mib` – default amount of memory for a VM, in MiB
* `default_cpus` – default number of CPUs for a VM
* `image_directory` – directory where VM image files are put
* `authorized_keys` – list of filenames to SSH public keys, to
  be put into the default user's `authorized_keys` file in the VM

## Specification fields

The specification file is YAML and may specify the following fields,
all of which override some default from the configuration.

* `ssh_key_files` – overrides `authorized_keys`
* `image_size_gib` – overrides `default_image_giv`
* `memory_mib` – overrides `default_memory_mib`
* `cpus` – overrides `default_cpus`
* `base` – overrides `default_base_image`
* `image` – overrides default image file name; must include
  pathname, is not put into the image directory by default