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)
shell_executable = None
use_default_on_error = False
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)
pyinfra.api.facts.get_fact_class(name)
pyinfra.api.facts.get_fact_names()

Returns a list of available facts in camel_case format.

pyinfra.api.facts.get_facts(state, name, args=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)

Wrapper around get_facts returning facts for one host or a function that does.

pyinfra.api.facts.get_short_facts(state, short_fact, **kwargs)
pyinfra.api.facts.is_fact(name)