The multi-deploy workflow enables efficient deployment of configuration changes across multiple network devices with the same role. It groups devices by shared configuration diffs and batches them for parallel processing while ensuring proper approval controls.
Use this Python workflow as a multi-device optimization of the configuration deployment workflow.
Overview
The workflow consists of two main components:
- MultiDeployWorkflow: The parent workflow that discovers devices, collects diffs, groups them, and orchestrates batch deployments
- BatchDeployWorkflow: Child workflows that handle deployment to groups of devices with identical configuration changes
Key Features
- Role-based device discovery: Automatically discovers all devices with a specified role from Nautobot
- Intelligent diff grouping: Groups devices with identical configuration changes together
- Batch processing: Splits large groups into manageable batches based on configurable batch size
- Shared diff approval: Single approval process for all devices with the same configuration changes
- Fault tolerance: Continues processing even if individual devices fail
- Parallel execution: Applies configurations to multiple devices simultaneously within each batch
- Automatic backups: Creates configuration backups for successfully deployed devices
Architecture Notes
Individual device configurations: Each device has its own intended configuration file with its own commit SHA. The workflow groups devices based solely on identical diff content, not configuration file identity. This means:
- Devices can have different intended configuration files but produce the same diff
- Each device maintains its own commit SHA for backup and audit purposes
- Grouping is purely based on the similarity of configuration changes
- This enables efficient batch processing while preserving individual device configuration integrity
Workflow Stages
1. Discover Devices
- Queries Nautobot for all devices matching the specified role and filters
- Returns early if no devices are found
2. Collect Diffs
- Loads intended configuration for each device
- Generates configuration diffs in parallel
- Filters out devices with no changes
- Collects errors for devices that fail diff generation
3. Group and Batch
- Groups devices by identical configuration diffs using SHA256 hash
- Splits large groups into batches based on
max_batch_size
- Creates batch execution plan
4. Execute Batches
- Spawns child workflows for each batch
- Each child workflow handles:
- Shared diff review and approval
- Parallel configuration application
- Backup execution for successful devices
Child Workflow (BatchDeployWorkflow)
A separate child workflow handles each batch and provides:
Review Shared Diff Stage
- Displays the shared configuration diff for all devices in the batch
- Requires manual approval before proceeding
- Shows device list and change summary
Apply Configurations Stage
- Applies approved configuration to all devices in parallel
- Continues processing even if individual devices fail
- Reports success and failure counts
- Creates configuration backups for successfully deployed devices
- Runs backup workflows as child processes
Error Handling
The workflow is designed to be fault-tolerant:
- Discovery Failures: Reports if no devices found for the role
- Diff Collection Failures: Individual device failures do not stop the workflow
- Application Failures: Failed devices are reported but do not affect other devices
- Child Workflow Failures: Handled gracefully with error reporting
Usage Example
Workflow Results
The workflow returns comprehensive results:
Best Practices
Batch sizing: Choose appropriate batch sizes based on your environment.
- Small batches (5-10): Better error isolation, more granular approval
- Large batches (20-50): Fewer approval steps, faster deployment
Role selection: Use specific device roles to ensure only intended devices are targeted.
Pre-deployment validation: Run validation workflows before you run the multi-deploy workflow.
Monitoring: Monitor child workflows for approval status and completion.
Rollback planning: Have rollback procedures ready for failed deployments.
Approval Workflow
The multi-deploy workflow provides seamless navigation between parent and child workflows.
Parent Workflow (MultiDeployWorkflow)
- Execute batches stage: Displays clickable links to each child workflow batch
- Real-time updates: Shows batch status as workflows progress
- Navigation: Click on batch links to review and approve individual diffs
Child Workflows (BatchDeployWorkflow)
Each batch requires manual approval:
- Review Shared Diff: Detailed view of configuration changes with:
- Device list for the batch
- Configuration diff hash for tracking
- Commit ID information
- Full diff content
- Approve or reject: Manual approval gate for each batch
- Deployment: Parallel configuration application to all devices in batch
- Backup: Automatic backup creation for successful deployments
Navigation Example
The parent workflow displays clickable links with full UI URLs like:
After completion, status is shown with full UI URLs:
UI URL Construction
The workflow automatically constructs full UI URLs using the configured UI hostname:
- Configuration Source: Reads
ui_url from the Temporal section of the Config Manager INI configuration
- URL Format:
https://{ui_url}/workflows/{workflow_id}
- Example: For
ui_url = config-manager.example.com, links will point to https://config-manager.example.com/workflows/...
- Environment Specific: Each environment has its own UI URL configured in the Helm values file and injected into the configuration through Vault
- Configuration Path: generated Helm values to the rendered Config Manager INI to
ui_url
- Workflow Safe: UI URL is retrieved through a dedicated activity to maintain workflow determinism and avoid configuration loading in workflow code
Configuration Example
In helm/values-example.yaml:
This becomes part of the rendered Config Manager INI:
The workflow then constructs URLs like:
Technical Implementation
The workflow uses a dedicated get_ui_base_url() activity to retrieve the UI URL:
- Activity reads the rendered Config Manager INI
- Returns the
ui_url value to the workflow
- Workflow uses this URL throughout its execution for child workflow links
- This approach maintains Temporal’s deterministic execution requirements by avoiding configuration file access within workflow code
Integration
The Multi-Deploy Workflow integrates with:
- Nautobot: Device discovery and metadata
- GitLab: Configuration storage and versioning
- Backup Workflow: Automatic post-deployment backups
- NATS: Event notifications
- NVIDIA Config Manager UI: Approval and monitoring interface
Limitations
- All devices in a batch must have identical configuration changes
- Requires manual approval for each unique diff group
- No automatic rollback on partial failures
- Limited to network devices supported by existing device clients