swagspace-cloud-init/README.md
2025-07-13 14:23:13 +02:00

32 lines
1.6 KiB
Markdown

# Swagspace Cloud Init
This script builds VMs for the Swagspace infrastructure.
It takes gets the name of a VM, collect further data (CPUs, memory, IP addresses) from NetBox via GraphQL and creates a VM using [virt-install](https://virt-manager.org/index.html) and [cloud-init](https://cloudinit.readthedocs.io/en/latest/index.html).
It asks for a password for the user.
```
usage: build-vm [-h] [--instance INSTANCE] [--config CONFIG] [--url URL] [--token TOKEN] [--graphql-url GRAPHQL_URL] [--base_image BASE_IMAGE] [--image_dir IMAGE_DIR] [--network-bridge NETWORK_BRIDGE] [--dry-run] [--overwrite] [--username USERNAME] vm_name
positional arguments:
vm_name The name of the VM to build
options:
-h, --help show this help message and exit
--instance INSTANCE the name of the instance to use
--config CONFIG the config file to use
--url URL the URL of the NetBox API endpoint
--token TOKEN the token for the NetBox REST API
--graphql-url GRAPHQL_URL
The URL for the GraphQL endpoint
--base_image BASE_IMAGE
The path to the cloud-init image to use. Default: 'debian13-cloud-init.qcow2'
--image_dir IMAGE_DIR
The location where the image should be stored.
--network-bridge NETWORK_BRIDGE
Name of the bridge the VM should be attached to
--dry-run Query NetBox, build the cloud-init files but don't actually build the image
--overwrite overwrite the image, if it exists
--username USERNAME name of the user, Default: jo
```