• Stars
    star
    2,400
  • Rank 18,367 (Top 0.4 %)
  • Language
    Python
  • License
    MIT License
  • Created over 9 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

pyinfra automates infrastructure super fast at massive scale. It can be used for ad-hoc command execution, service deployment, configuration management and more.

pyinfra

Note: this is the v3 branch, which is currently in beta. See the docs for v3. If needed the 2.x branch is here, but is in bugfix only mode.

pyinfra automates infrastructure using Python. It’s fast and scales from one server to thousands. Great for ad-hoc command execution, service deployment, configuration management and more.


Documentation ⇒ Getting Started • Examples • Help & Support • Contributing

Chat ⇒ #pyinfra on Matrix


Why pyinfra? Design features include:

  • 🚀 Super fast execution over thousands of hosts with predictable performance.
  • 🚨 Instant debugging with realtime stdin/stdout/stderr output (-vvv).
  • 🔄 Idempotent operations that enable diffs and dry runs before making changes.
  • 📦 Extendable with the entire Python package ecosystem.
  • 💻 Agentless execution against anything with shell access.
  • 🔌 Integrated with connectors for Docker, Terraform, Vagrant and more.

Quickstart

Install pyinfra with pip:

pip install pyinfra

Now you can execute commands on hosts via SSH:

pyinfra my-server.net exec -- echo "hello world"

Or target Docker containers, the local machine, and other connectors:

pyinfra @docker/ubuntu exec -- echo "Hello world"
pyinfra @local exec -- echo "Hello world"

As well as executing commands you can define state using operations:

# Install iftop apt package if not present
pyinfra @docker/ubuntu apt.packages iftop update=true _sudo=true

Which can then be saved as a Python file like deploy.py:

from pyinfra.operations import apt

apt.packages(
    name="Ensure iftop is installed",
    packages=['iftop'],
    update=True,
    _sudo=True,
)

The hosts can also be saved in a file, for example inventory.py:

targets = ["@docker/ubuntu", "my-test-server.net"]

And executed together:

pyinfra inventory.py deploy.py

Now you know the building blocks of pyinfra! By combining inventory, operations and Python code you can deploy anything.

See the more detailed getting started or using operations guides. See how to use inventory & data, global arguments and the CLI or check out the documented examples.


PyPI version PyPi downloads Docs status Execute tests status Codecov Coverage MIT Licensed

More Repositories

1

Luapress

📰 Static site/blog generator written in Lua.
Lua
199
star
2

ElasticQuery

A simple (Python) query builder for Elasticsearch
Python
80
star
3

selected.js

A simple, dependency free <select> replacement
HTML
34
star
4

opengl-graphing

2D & 3D graph plots in OpenGL (for University)
C
24
star
5

Luawa

Lua Web Application (Framework)
Lua
20
star
6

pyinfra-docker

Install and configure Docker using pyinfra.
Python
11
star
7

Lua-Bits

Bits of Lua code
Lua
11
star
8

luapress.org

Luapress website source & config
CSS
10
star
9

Fanatical-Dev-Core

Micro OpenID/FB-connect based PHP framework
PHP
9
star
10

PK-Russet

Pokemon in Javascript on both browser & Node.
JavaScript
7
star
11

dotfiles

🔧 My dotfiles
Shell
5
star
12

pyinfra-etcd

Install & bootstrap etcd clusters with pyinfra.
Python
4
star
13

SourceServerStats

Source engine server stats & analysis
JavaScript
4
star
14

pointlessramblings.com

🎩 Hugo, Markdown and templates for my blog.
CSS
3
star
15

yummymarks

yummymarks 2.0
Lua
3
star
16

Licenses

Pre-made LICENSE.md files
2
star
17

pydocs

Auto generate markdown documents with Python
Python
2
star
18

pyinfra-examples

A set of documented and tested pyinfra deploys.
2
star
19

pyinfra-performance

💥 pyinfra Performance Comparisons
Shell
2
star
20

ports

Tiny Python web service to check for open ports
Python
1
star
21

FizzStat

Web stats without cookies or localstorage
Python
1
star
22

proj

Open Sublime projects from a terminal, with autocomplete
Shell
1
star
23

util.js

Tiny JavaScript utility library
JavaScript
1
star
24

venv

A super simple virtualenv manager
Shell
1
star
25

Fizzadar

Yes.
1
star
26

clash-prometheus-exporter

Go
1
star
27

JsonTest

Automatically generate Python tests from JSON files
Python
1
star