Introduction
pyinfra provides a powerful command-line interface for managing the state of one or more servers. It can be used for app/service deployment, configuration management, and ad-hoc command execution.Basic Usage
The pyinfra CLI follows this general pattern:- INVENTORY: Defines the target hosts (file, hostname, or comma-separated list)
- OPERATIONS: Specifies what to execute (deploy files, operations, commands, or facts)
- OPTIONS: Additional flags to control behavior
Command Modes
pyinfra supports several different operation modes:Deploy Files
Execute one or more Python deploy files:Operations
Run a single operation directly:Exec Commands
Execute arbitrary shell commands:Facts
Gather facts from target hosts:Debug Inventory
Inspect inventory hosts and data:Inventory Formats
pyinfra accepts inventory in multiple formats:Inventory File
Single Host
Multiple Hosts
Common Workflows
Dry Run
Preview changes without executing:Verbose Output
Increase verbosity to see more details:Limit Hosts
Restrict execution to specific hosts or groups:Auto-Execute
Skip confirmation prompts:Environment Variables
Some options can be set via environment variables:PYINFRA_YES: Equivalent to-y/--yesflag for auto-execution
Getting Help
Display help information:Next Steps
- Learn about CLI commands for detailed command modes
- Explore CLI arguments for all available flags and options
- Read the full documentation at docs.pyinfra.com
