A Comprehensive Tool for Setting Up Virtual Machines.
Project description
🚀 VM Setup Tool
Documentation • PyPI • GitHub • Contributing • License
A modern, user-friendly solution for automating and managing virtual machine (VM) setup and configuration using Ansible.
✨ Features
- Automated VM setup with Docker & Docker Compose
- Cloud VM provisioning via SSH (AWS, GCP, Azure)
- Kubernetes Ready: One-click K3s cluster setup + manifest/Helm deployments
- CI/CD Pipelines: Deploy to Kubernetes from GitHub Actions with zero kubectl boilerplate
- Observability: Instant Prometheus & Grafana deployment
- SSH key management and configuration
- Simple Python API for integration
- One-command version check:
vm_tool --version
⚡️ Installation
Install the latest version from PyPI:
pip install vm-tool
🛠️ Usage Examples
🚀 Universal Deployment (CLI)
1. Generate CI/CD Pipeline
Bootstrap your project with a complete GitHub Actions workflow:
vm_tool generate-pipeline
2. Setup Kubernetes (K3s)
Deploy a lightweight Kubernetes cluster to your servers:
vm_tool setup-k8s --inventory inventory.yml
3. Deploy to Kubernetes
Deploy manifests or Helm charts to an existing Kubernetes cluster:
# Manifest-based deployment
vm_tool deploy-k8s \
--method manifest \
--manifest ./k8s/ \
--namespace myapp \
--kubeconfig ~/.kube/config
# Helm-based deployment
vm_tool deploy-k8s \
--method helm \
--helm-chart ./charts/myapp \
--helm-release myapp \
--namespace myapp \
--kubeconfig ~/.kube/config
4. Deploy to Kubernetes from CI/CD (no SSH needed)
Pass a base64-encoded kubeconfig, inject images, and sync secrets — all from GitHub Actions:
vm_tool deploy-k8s \
--method manifest \
--manifest k8s/ \
--namespace myapp \
--kubeconfig-b64 "$KUBECONFIG_B64" \
--image "IMAGE_REGISTRY/myapp:IMAGE_TAG=${IMAGE_REF}" \
--k8s-secret "app-secret=${APP_ENV}" \
--k8s-secret "db-secret=${DB_ENV}" \
--registry-secret "ghcr-secret=ghcr.io:${GH_ACTOR}:${GH_TOKEN}" \
--timeout 300
CI flags:
| Flag | Description |
|---|---|
--kubeconfig-b64 |
Base64-encoded kubeconfig (decoded to ~/.kube/config automatically) |
--image KEY=VALUE |
Substitute image refs in manifests. Key format: PLACEHOLDER_VAR=actual_image:tag |
--k8s-secret NAME=ENVFILE |
Create/update a generic Kubernetes secret from an env-file string |
--registry-secret NAME=SERVER:USER:PASS |
Create/update a docker-registry pull secret |
--dry-run |
Validate manifests against the cluster without applying |
--force |
Skip hash-based change detection and always deploy |
5. Setup Observability
Deploy Prometheus and Grafana for instant monitoring:
vm_tool setup-monitoring --inventory inventory.yml
📦 GitHub Actions Example
Full pipeline: build image → push to GHCR → deploy to Kubernetes:
jobs:
build:
runs-on: ubuntu-latest
outputs:
image_tag: ${{ steps.meta.outputs.version }}
image: ${{ steps.image.outputs.full }}
steps:
- uses: actions/checkout@v4
# ... docker build-push steps ...
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install kubectl
uses: azure/setup-kubectl@v4
- name: Install vm_tool
run: pip install vm-tool
- name: Deploy with vm_tool
env:
IMAGE_REF: ${{ needs.build.outputs.image }}:${{ needs.build.outputs.image_tag }}
KUBECONFIG_B64: ${{ secrets.KUBECONFIG_B64 }}
APP_ENV: ${{ secrets.APP_ENV }}
DB_ENV: ${{ secrets.DB_ENV }}
GH_ACTOR: ${{ github.actor }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
vm_tool deploy-k8s \
--method manifest \
--manifest k8s/ \
--namespace myapp \
--kubeconfig-b64 "$KUBECONFIG_B64" \
--image "IMAGE_REGISTRY/myapp:IMAGE_TAG=${IMAGE_REF}" \
--k8s-secret "app-secret=${APP_ENV}" \
--k8s-secret "db-secret=${DB_ENV}" \
--registry-secret "ghcr-secret=ghcr.io:${GH_ACTOR}:${GH_TOKEN}" \
--timeout 300 \
--force
Secret setup: Store your cluster's kubeconfig as a base64 secret:
gh secret set KUBECONFIG_B64 --body "$(base64 -i ~/.kube/config)"
🐍 Python API Usage
Automated Local VM Setup
from vm_tool.runner import SetupRunner, SetupRunnerConfig
config = SetupRunnerConfig(
github_username='your_github_username',
github_token='your_github_token',
github_project_url='your_github_project_url',
github_branch='your_branch_name',
docker_compose_file_path='path_to_your_docker_compose_file',
dockerhub_username='your_dockerhub_username',
dockerhub_password='your_dockerhub_password'
)
runner = SetupRunner(config)
runner.run_setup()
Cloud VM Setup (via SSH)
from vm_tool.runner import SetupRunner, SetupRunnerConfig, SSHConfig
config = SetupRunnerConfig(
github_username='your_github_username',
github_token='your_github_token',
github_project_url='your_github_project_url',
github_branch='your_branch_name',
docker_compose_file_path='path_to_your_docker_compose_file',
dockerhub_username='your_dockerhub_username',
dockerhub_password='your_dockerhub_password'
)
runner = SetupRunner(config)
ssh_configs = [
SSHConfig(
ssh_username='your_ssh_username',
ssh_password='your_ssh_password',
ssh_hostname='your_ssh_hostname',
ssh_identity_file='/path/to/your/ssh_key' # Optional
)
]
runner.run_cloud_setup(ssh_configs)
Kubernetes Deployment via Python API
from vm_tool.runner import SetupRunner, SetupRunnerConfig
config = SetupRunnerConfig(...)
runner = SetupRunner(config)
runner.run_k8s_deploy(
method="manifest",
manifest="k8s/",
namespace="myapp",
kubeconfig_b64="<base64-encoded-kubeconfig>",
images={"IMAGE_REGISTRY/myapp:IMAGE_TAG": "ghcr.io/org/myapp:sha-abc123"},
k8s_secrets={"app-secret": "KEY=val\nOTHER=val2"},
registry_secrets={"ghcr-secret": ("ghcr.io", "user", "token")},
timeout=300,
force=True,
)
SSH Key Management
from vm_tool.ssh import SSHSetup
ssh_setup = SSHSetup(
hostname='your_vm_hostname',
username='your_vm_username',
password='your_vm_password',
email='your_email_for_ssh_key'
)
ssh_setup.setup()
🖥️ Command Line Version Check
Check your installed version at any time:
vm_tool --version
⚙️ Configuration Options
github_username: GitHub username (for private repos)github_token: GitHub token (for private repos)github_project_url: GitHub repository URLgithub_branch: Branch to use (default: main)docker_compose_file_path: Path to Docker Compose file (default: docker-compose.yml)dockerhub_username: Docker Hub username (if login needed)dockerhub_password: Docker Hub password (if login needed)
📚 Learn More
See the Official Documentation for complete guides. Visit the PyPI page for details, or the GitHub repository for code and issues.
🗺️ Roadmap
- Terraform integration —
vm_tool provisioncommand wrappingterraform applywith variable passthrough - Per-host password support — when multiple SSH configs have different passwords, support a per-host vault lookup instead of last-wins env var
- Traffic splitting — built-in nginx/AWS ALB/HAProxy helpers for blue-green and canary
_switch_trafficoverride
Empower your infrastructure automation with VM Setup Tool – fast, reliable, and developer-friendly!
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vm_tool-1.1.2.tar.gz.
File metadata
- Download URL: vm_tool-1.1.2.tar.gz
- Upload date:
- Size: 80.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dff6cb5c468772bc5566259eebcfd84c9dc2730051436a80e673b1d6b3d3d4b6
|
|
| MD5 |
47c8eefba6886101003f99ece8e91d03
|
|
| BLAKE2b-256 |
1dd8ca1262e2fe99d78a53d0029d0dd0f117645f4d0b2467b59b6b6df76e54fe
|
Provenance
The following attestation bundles were made for vm_tool-1.1.2.tar.gz:
Publisher:
publish.yml on thesunnysinha/vm_tool
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vm_tool-1.1.2.tar.gz -
Subject digest:
dff6cb5c468772bc5566259eebcfd84c9dc2730051436a80e673b1d6b3d3d4b6 - Sigstore transparency entry: 1270491153
- Sigstore integration time:
-
Permalink:
thesunnysinha/vm_tool@8315001a82c2ce8b70500c608043d9c5b1eae88a -
Branch / Tag:
refs/tags/v1.1.2 - Owner: https://github.com/thesunnysinha
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8315001a82c2ce8b70500c608043d9c5b1eae88a -
Trigger Event:
push
-
Statement type:
File details
Details for the file vm_tool-1.1.2-py3-none-any.whl.
File metadata
- Download URL: vm_tool-1.1.2-py3-none-any.whl
- Upload date:
- Size: 104.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0b43d120b4f3e91876fb29402793f4313502a190c6d13b8d029b80296adfa36
|
|
| MD5 |
563b3f46a0a2a2bc0d59815bd56b5f60
|
|
| BLAKE2b-256 |
a4bce23b96d19967495db16adc8d7902296361e489cc3e3223dc33ff22ea8185
|
Provenance
The following attestation bundles were made for vm_tool-1.1.2-py3-none-any.whl:
Publisher:
publish.yml on thesunnysinha/vm_tool
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vm_tool-1.1.2-py3-none-any.whl -
Subject digest:
d0b43d120b4f3e91876fb29402793f4313502a190c6d13b8d029b80296adfa36 - Sigstore transparency entry: 1270491177
- Sigstore integration time:
-
Permalink:
thesunnysinha/vm_tool@8315001a82c2ce8b70500c608043d9c5b1eae88a -
Branch / Tag:
refs/tags/v1.1.2 - Owner: https://github.com/thesunnysinha
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8315001a82c2ce8b70500c608043d9c5b1eae88a -
Trigger Event:
push
-
Statement type: