This Python tool provides a command-line interface (CLI) for managing Vagrant environments and configurations. It supports defining and managing various Vagrant configuration parameters like VM name, memory, CPUs, synced folders, and forwarded ports, and includes the ability to generate Virtual Machines (VMs) deploying services through Docker Compose.
Ensure you have Vagrant
and VirtualBox
installed to manage VMs effectively.
Clone the repository:
git clone https://gitlab.cylab.be/cylab/dogrant.git
Create a virtual environment and activate it (optional):
python3 -m venv appenv
source appenv/bin/activate
Install the required dependencies:
python3 -m pip install -r requirements.txt
Ensure you have Vagrant
and VirtualBox
installed for managing VMs.
The application provides multiple commands to manage the Vagrant environment. It uses Typer to define the CLI interface.
To run the CLI, execute the following command:
python3 app.py
You can also run specific commands directly (e.g., for configuration or VM generation):
python3 app.py generate config
generate config
Define the configuration of your Vagrant environment with this command. Customize parameters:
Example:
python3 app.py generate config
generate vm
Generate and export a Vagrant VM with Docker Compose services deployed inside the generated
folder. The output includes an .ova
file and an SSH private_key
for secure access.
Example:
python3 app.py generate vm
Access the deployed VM:
ssh -i generated/private_key vagrant@<host-ip>
clean config
Remove the Vagrantfile to reset your configuration.
Example:
python3 app.py clean config
clean vm
Clean up the exported VM files from the generated
folder.
Example:
python3 app.py clean vm
Library Import Errors: Use Python 3.8 or 3.9 for compatibility. If issues persist, manually adjust Python environment modules.
Vagrant and VirtualBox Compatibility: Downgrade to VirtualBox 6 if compatibility problems occur.