Skip to main content

Pluggable Infrastructure CLI as a wrapper around DevOps tools.

Project description

infra-cli

License Python Version

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: PythonAnsibleTerraform / TerragruntPackerPulumi → (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 for ansible-playbook with 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 (print export AWS_PROFILE=... for eval).
  • packer: Build and validate machine images consistently.
  • terragrunt: Manage Terraform state and deployments with Terragrunt; --create scaffolds 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.14", pipx may be using a Python < 3.14. Use the interpreter that satisfies the requirement:

pipx install --python python3.14 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.11+ (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.

👩‍💻 Development

We welcome contributions! To set up your local development environment:

  1. Clone the repo: git clone https://github.com/hanyouqing/infra-cli.git
  2. Install dev dependencies: make dev-install (or for a reproducible env: pip install -r requirements.txt then pip install -e .)
  3. Optional – regenerate lock file: make lock (requires pip-tools; updates requirements.txt from pyproject.toml)
  4. Run linting: make lint
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

infra_cli-0.1.1.tar.gz (65.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

infra_cli-0.1.1-py3-none-any.whl (77.0 kB view details)

Uploaded Python 3

File details

Details for the file infra_cli-0.1.1.tar.gz.

File metadata

  • Download URL: infra_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 65.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for infra_cli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 dfdbb4f903f320c4223199058cc1011dc455e7ded806d11e110ce2c61dba007f
MD5 9553dbd2c18404c2d69dc94a67e9a41e
BLAKE2b-256 a790e986d79cf666909f11b75b977b103d3f7bdfdc55cea7274f985f6810276a

See more details on using hashes here.

File details

Details for the file infra_cli-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: infra_cli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 77.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for infra_cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f73c50989090dce0abc983192fba0dcffc6079172116437bd4094500a7648b1a
MD5 6966de4404463161497ae8f004171df3
BLAKE2b-256 0eb5422210a0e70936eeb8a42d92171b09c43df632eeda5fc4d740ec6b13e429

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page