Skip to content

Multiple machines

If you would like to define more than one VM in a single directory, simply give one (or both) a name by appending it to the virtfile filename.

For example, you may have a virtfile named virtfile.web that defines a web server VM, and one named virtfile.db that defines a database VM.

You can then run commands on the separate machines by using the -m/--machine option, or use the NVIRT_MACHINE env var to control which one nvirt operates on by default:

Example: Controlling different machines in the same directory

In a shell:

# in a directory that contains virtfile.db and virtfile.web

export NVIRT_MACHINE=web

nvirt up        # runs "nvirt up" on the machine defined in virtfile.web
nvirt up -m db  # runs "nvirt up" on the machine defined in virtfile.db

If you need to explicitly refer to the default virtfile (with no .name extension), you can use a machine name of default when running commands.