Overview
Add machine-readable JSON output format (--output-format json) to the provision command. This enables automation workflows to programmatically extract the provisioned instance IP address and connection details without regex parsing of console output.
Specification : docs/issues/352-add-json-output-to-provision-command.md
Parent Epic : #348 - Add JSON output format support
Related : #349 (completed reference implementation for create command)
Roadmap : Section 12.2
Goals
Implement JSON output format for provision command
Preserve existing human-readable output as default
Enable automation to extract instance IP reliably
Follow the architecture pattern established in Add JSON Output to create Command #349
Key Features
JSON Output
torrust-tracker-deployer provision my-env --output-format json
Returns:
{
"environment_name" : " my-env" ,
"instance_name" : " torrust-tracker-vm-my-env" ,
"instance_ip" : " 10.140.190.39" ,
"ssh_username" : " torrust" ,
"ssh_port" : 22 ,
"ssh_private_key_path" : " /path/to/key" ,
"provider" : " lxd" ,
"provisioned_at" : " 2026-02-16T16:00:00Z" ,
"domains" : [" tracker.example.com" ]
}
Critical Fields
instance_ip : Most important for automation - enables automated workflows
ssh_private_key_path : Enables automated SSH connections without manual key management
domains : Enables automated DNS record updates for HTTPS deployments
Architecture
Implementation Phases
Phase 0 : Study create command reference implementation
Phase 1 : Create ProvisionDetailsData DTO
Phase 2 : Implement TextView and JsonView
Phase 3 : Wire format switching in controller
Phase 4 : Update tests
Phase 5 : Testing and validation
Phase 6 : Documentation
Automation Use Cases
SSH Connection Automation : Extract IP + credentials for automated SSH testing
DNS Update Automation : Update DNS records immediately after provisioning
Complete Deployment Pipeline : Provision → DNS → Wait for SSH → Configure → Release → Run
Acceptance Criteria
✅ JSON output with --output-format json flag
✅ Default text output unchanged
✅ All fields present and correct
✅ Works with both LXD and Hetzner providers
✅ Progress logs to stderr, JSON to stdout
✅ Pre-commit checks pass
✅ Documentation updated
Related Documentation
Overview
Add machine-readable JSON output format (
--output-format json) to theprovisioncommand. This enables automation workflows to programmatically extract the provisioned instance IP address and connection details without regex parsing of console output.Specification: docs/issues/352-add-json-output-to-provision-command.md
Parent Epic: #348 - Add JSON output format support
Related: #349 (completed reference implementation for create command)
Roadmap: Section 12.2
Goals
Key Features
JSON Output
Returns:
{ "environment_name": "my-env", "instance_name": "torrust-tracker-vm-my-env", "instance_ip": "10.140.190.39", "ssh_username": "torrust", "ssh_port": 22, "ssh_private_key_path": "/path/to/key", "provider": "lxd", "provisioned_at": "2026-02-16T16:00:00Z", "domains": ["tracker.example.com"] }Critical Fields
Architecture
src/presentation/views/commands/provision/)Implementation Phases
ProvisionDetailsDataDTOAutomation Use Cases
Acceptance Criteria
--output-format jsonflagRelated Documentation