pyinfra.api.facts module

The pyinfra facts API. Facts enable pyinfra to collect remote server state which is used to “diff” with the desired state, producing the final commands required for a deploy.

class pyinfra.api.facts.FactBase

Bases: object

abstract = True
static default()

Set the default attribute to be a type (eg list/dict).

static process(output)
process_pipeline(args, output)
requires_command = None
shell_executable = None
class pyinfra.api.facts.FactMeta(name, bases, attrs)

Bases: type

Metaclass to dynamically build the facts index.

class pyinfra.api.facts.ShortFactBase

Bases: object

fact = None
name = 'short_fact_base'
pyinfra.api.facts.create_host_fact(state, host, name, data, args=None)
pyinfra.api.facts.delete_host_fact(state, host, name, args=None)

Returns a list of available facts in camel_case format.

pyinfra.api.facts.get_facts(state, name_or_cls, args=None, kwargs=None, ensure_hosts=None, apply_failed_hosts=True)

Get a single fact for all hosts in the state.

pyinfra.api.facts.get_host_fact(state, host, name, args=None, kwargs=None)
pyinfra.api.facts.get_short_facts(state, short_fact, **kwargs)