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(func_or_name: Callable[[...], Any] | str, data_defaults=None, _call_location=None)

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

pyinfra.api.deploy.show_state_host_arguments_warning(call_location)