pyinfra.api.deploy module

Deploys come in two forms: on-disk, eg deploy.py, and @deploy wrapped functions. The latter enable re-usable (across CLI and API based execution) pyinfra extension creation (eg pyinfra-openstack).

pyinfra.api.deploy.add_deploy(state: State, deploy_func: Callable[[...], Any], *args, **kwargs)

Prepare & add an deploy to pyinfra.state by executing it on all hosts.

Parameters
  • state (pyinfra.api.State obj) – the deploy state to add the operation
  • deploy_func (function) – the operation function from one of the modules,
  • server.user (ie) –
  • args/kwargs – passed to the operation function
pyinfra.api.deploy.deploy(name: str | None = None, data_defaults=None)

Decorator that takes a deploy function (normally from a pyinfra_* package) and wraps any operations called inside with any deploy-wide kwargs/data.