Pluggable Infrastructure CLI as a wrapper around DevOps tools.
Project description
infra-cli
infra-cli is a pluggable infrastructure management tool designed to wrap common DevOps tools (Terragrunt, Ansible, Pulumi, Packer, Terraform, etc.) into a single, unified interface. It simplifies complex workflows through sensible conventions and centralized configuration, and helps learners follow best practices from day one (directory layout, config, and official-style docs).
🎓 DevOps Learning
Use infra to create learning projects that follow best-practice structure and include READMEs with official docs, tool best practices, and a step-by-step learning path from zero to advanced infrastructure engineer:
# Create a Python project (src layout, pyproject.toml, tests, README with learning path)
infra python -p learn-python
# Ansible: scaffold playbooks and structure
infra ansible -p learn-ansible --create
# Terragrunt: scaffold multi-env layout (account/region/env/name)
infra tg -e dev -p learn-tg -r us-east-1 -s vpc --create
Recommended order: Python → Ansible → Terraform / Terragrunt → Packer → Pulumi → (future K8s). See docs/LEARNING_PATH.md for the full path and links to official documentation.
🚀 Key Features
- Unified Interface: A single command (
infra) to manage multiple infrastructure tools. - Plugin Architecture: Easily extensible logic for different tools.
- Convention over Configuration: Default directory structures that "just work."
- Centralized Config: Manage all tool settings in one place (
~/.infra/config.yaml). - AWS SSO Integration: Seamlessly handles authentication and profile generation.
- Local Environment Setup: Automate the configuration of your macOS or Ubuntu dev environment.
🛠 Supported Plugins
python: Scaffold a best-practice Python project (src layout, pyproject.toml, README with official docs and learning path). Example:infra python -p learn-python.setup: Bootstrap your local development environment (macOS/Ubuntu).ansible: Wrapper foransible-playbookwith automatic project scaffolding (--create).aws: AWS subcommands:login(SSO, default),sync(sync account/role profiles),whoami(caller identity),exec(run any AWS CLI command),env(printexport AWS_PROFILE=...for eval).packer: Build and validate machine images consistently.terragrunt: Manage Terraform state and deployments with Terragrunt;--createscaffolds AWS-style layout.terraform: Run native Terraform commands (plan, apply, etc.) with infra context.pulumi: Infrastructure as Code using Pulumi.github: Manage repository settings and scaffolding.slack: Send notifications to Slack webhooks.
🏁 Quick Start
Installation
From PyPI (recommended):
brew install pipx
brew upgrade pipx
pipx install infra-cli
# or: pip install infra-cli
If you see "No matching distribution found" or "Requires-Python >=3.12", pipx may be using a Python < 3.12. Use the interpreter that satisfies the requirement:
pipx install --python python3.12 infra-cli
# or from your venv: pip install infra-cli
From source (development or unreleased version):
git clone https://github.com/hanyouqing/infra-cli.git
cd infra-cli
pipx install .
# or: pip install -e .
Source install uses Python 3.12+ (see pyproject.toml).
Basic Usage
# Setup your local environment
infra setup
# AWS: SSO login (default), whoami, or run CLI with profile
infra aws
infra aws whoami --profile sso
infra aws exec s3 ls
eval $(infra aws env --profile sso)
# Run an Ansible playbook
infra ansible site.yml
# Check configuration
infra config
⚙️ Configuration
infra-cli uses a YAML configuration file located at ~/.infra/config.yaml.
Managing Config via CLI
You can get or set configuration values directly:
# Set a default user name for the setup plugin
infra config setup.user_name=your_name
# View current configuration
infra config
Manual Configuration
The default config.yaml is generated on first run with sensible defaults. You can customize per-plugin settings like region, env, or extra_args.
Configurable Directory Tree (Terragrunt / Terraform)
For terragrunt and terraform plugins, the directory tree used by --create and path resolution is configurable via path_pattern:
terragrunt:
path_pattern: ${account}/${region}/${env}/${name} # default
# Or your own layout, e.g.:
# path_pattern: ${env}/${account}/${region}/${service}/${name}
Placeholders: ${env}, ${account}, ${region}, ${service}, ${name}. Map to CLI: -e→env, -p→account, -r→region, -s→service/name. Empty segments are omitted.
👩💻 Development
We welcome contributions! To set up your local development environment:
- Clone the repo:
git clone https://github.com/hanyouqing/infra-cli.git - Install dev dependencies:
make dev-install(or for a reproducible env:pip install -r requirements.txtthenpip install -e .) - Optional – regenerate lock file:
make lock(requires pip-tools; updatesrequirements.txtfrompyproject.toml) - Run linting:
make lint - Run tests:
make test
For more details, see CONTRIBUTING.md.
📜 License
This project is licensed under the Apache-2.0 License. See the LICENSE file for details.
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 infra_cli-0.1.3.tar.gz.
File metadata
- Download URL: infra_cli-0.1.3.tar.gz
- Upload date:
- Size: 167.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e063d3929d60b707c401f2dcf37f03a43e6b0c86fe5bb15d92306e285388de6c
|
|
| MD5 |
ec32bda28e803cb72e009ecc1184306d
|
|
| BLAKE2b-256 |
7531e7995120b83f84a42e3a6ba86b7456f01929836e37dc71cd567e1847f6b0
|
File details
Details for the file infra_cli-0.1.3-py3-none-any.whl.
File metadata
- Download URL: infra_cli-0.1.3-py3-none-any.whl
- Upload date:
- Size: 196.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8276edd057205d2b4ccf454775aaa581332baae234dae0847a7eb150282baeb6
|
|
| MD5 |
ee8c452b1a52b39a69c6b6e367c5f5e8
|
|
| BLAKE2b-256 |
d561859409fc7a25608af4e405025d7ab4ccde5bc637f80f317f3f339d0aa294
|