Ansible Collection
Automate VergeOS infrastructure with the vergeio.vergeos Ansible collection — modules for VM snapshots, tagging, and imports, plus a dynamic inventory plugin for multi-site environments.
Ansible brings agentless, push-based automation to infrastructure management. The vergeio.vergeos Ansible collection extends Ansible with purpose-built modules and an inventory plugin for VergeOS, enabling you to manage VM snapshots, organize resources with tags, import VM images, and dynamically discover infrastructure across multiple sites — all through familiar YAML playbooks.
Collection Overview
The VergeOS Ansible collection is published on Ansible Galaxy and integrates directly with the VergeOS REST API through the pyvergeos Python SDK.
Namespace
vergeio
Collection
vergeos
Full Reference
vergeio.vergeos
Python
>= 3.9
Ansible
>= 2.14.0
SDK Dependency
pyvergeos >= 1.0.1
Source
Installation
Install the collection from Ansible Galaxy:
# Install from Galaxy (recommended)
ansible-galaxy collection install vergeio.vergeos
# Install the required Python SDK
pip install pyvergeosFor development or offline environments, build and install from source:
Authentication
The collection uses environment variables for API authentication, keeping credentials out of your playbooks and inventory files:
Alternatively, you can use API key authentication for non-interactive scenarios like CI/CD pipelines. API keys are created in System > Users > [select user] > API Keys within the VergeOS UI and provide Bearer token authentication without requiring username/password credentials.
Modules
The collection provides modules for VM lifecycle operations, tagging, and image management. Each module communicates with the VergeOS API through the pyvergeos SDK.
VM Snapshot Module
The vergeio.vergeos.vm_snapshot module creates and manages VM snapshots programmatically — useful for backup automation, pre-change checkpoints, and disaster recovery workflows.
Tag Management Modules
Tags provide a flexible classification system for organizing VergeOS resources. The collection includes two modules for tag management:
vergeio.vergeos.tag_category
Create and manage tag categories (e.g., "Environment", "Department")
vergeio.vergeos.tag
Apply and manage individual tags within categories
VM Import Capabilities
The collection deploys VMs from OVA templates that have already been uploaded to VergeOS — the vm_import module references an existing OVA by name or ID, and CPU and RAM are taken from the OVA itself. Upload the OVA first (UI or API), then run the playbook to create the VM.
Dynamic Inventory Plugin
The vergeos_vms inventory plugin queries the VergeOS API to dynamically discover VMs and build Ansible inventory — eliminating the need to maintain static host files.
API-Only Inventory
The inventory plugin retrieves VM metadata from the VergeOS API. It does not set ansible_host and does not support direct SSH connections out of the box. You must configure ansible_host through host variables, compose rules, or a separate connection strategy for SSH-based playbook execution.
Inventory Configuration
Create an inventory file (e.g., vergeos_inventory.yml):
Automatic Grouping
The plugin automatically organizes discovered VMs into groups based on multiple dimensions:
Site
datacenter_east, datacenter_west
Target playbooks to specific locations
Status
status_running, status_stopped
Run tasks only on active VMs
Tags
tag_Production, tag_Development
Environment-specific configuration
Tenant
tenant_acme, tenant_globex
Multi-tenant automation
OS Family
os_linux, os_windows
OS-specific playbooks
Cluster
cluster_compute01, cluster_compute02
Cluster-aware maintenance
Node
node_node1, node_node2
Node-level operations
Host Variables
Each discovered VM exposes over 20 host variables including VM ID, name, CPU cores, RAM, OS family, power state, cluster assignment, node placement, network configuration, tags, and the full VM data dictionary for advanced use cases.
Playbook Patterns
Multi-Site Snapshot Orchestration
Use tag-based filtering with the dynamic inventory to orchestrate snapshots across sites:
Tag Infrastructure Setup
Establish a consistent tagging taxonomy across your VergeOS environment:
Windows VM Import Workflow
Automate the import of Windows VM templates from OVA files:
Integration Patterns
Terraform + Ansible Pipeline
A common pattern combines Terraform for provisioning with Ansible for configuration: Terraform declares the infrastructure, Ansible configures what runs inside it.
Provisioning
Terraform
Create VMs, networks, users, drives
Discovery
Inventory
Query VergeOS API for newly created VMs
Configuration
Ansible
Install packages, configure services, apply security baselines
Validation
Ansible
Run smoke tests, verify connectivity, check compliance
Python SDK + Ansible
For complex workflows that need programmatic logic beyond what YAML playbooks offer, combine the pyvergeos Python SDK with Ansible:
CI/CD Integration
Ansible playbooks integrate naturally into CI/CD pipelines for infrastructure automation:
GitLab CI
Trigger Ansible playbooks from .gitlab-ci.yml stages for automated VM provisioning and configuration on merge to main.
Jenkins
Use the Ansible plugin for Jenkins to run playbooks as build steps, with credentials managed through Jenkins Credential Store.
GitHub Actions
Run Ansible playbooks in GitHub Actions workflows using the ansible-playbook action for pull request-driven infrastructure changes.
AWX / Tower
Deploy Ansible AWX for a web-based UI, RBAC, and scheduled playbook execution against VergeOS environments.
Best Practices
Credential Management
Never hardcode credentials in playbooks or inventory files — use environment variables or Ansible Vault
Use API keys for service accounts in production — they support IP allow-lists and expiration dates
Rotate credentials regularly and audit API key usage through the VergeOS UI
Inventory Strategy
Enable caching for large environments to reduce API calls and speed up playbook runs
Use filters to scope inventory to relevant VMs — avoid pulling the entire environment
Separate inventories per environment (dev, staging, production) for safety
Playbook Design
Use
delegate_to: localhostfor VergeOS API calls — the modules talk to the API, not to guest VMs via SSHLeverage tags for targeting — they provide a flexible, multi-dimensional grouping system
Implement idempotency — design playbooks that can be safely re-run without side effects
Further Reading
Last updated
Was this helpful?