pyinfra.api.inventory¶
-
class
pyinfra.api.inventory.
Inventory
(names_data, ssh_user=None, ssh_port=None, ssh_key=None, ssh_key_password=None, ssh_password=None, **groups)¶ Bases:
object
Represents a collection of target hosts. Stores and provides access to group data, host data and default data for these hosts.
Parameters: - names_data – tuple of
(names, data)
- ssh_user – default SSH user
- ssh_port – default SSH port
- ssh_key – default SSH key filename
- ssh_key_password – default password for the SSH key
- ssh_password – default SSH password
- **groups – map of group names ->
(names, data)
-
__getattr__
(key)¶ Get groups (lists of hosts) from the inventory by name.
-
__getitem__
(key)¶ Get individual hosts from the inventory by name.
-
__iter__
()¶ Iterates over inventory hosts. Uses active hosts only when they exist - in that sense can be seen as the “active” list of hosts during a deploy.
-
__len__
()¶ Returns a list of all hosts, connected or not.
-
get_data
()¶ Get the base/all data attached to this inventory.
-
get_group_data
(group)¶ Get data for a single group in this inventory.
-
get_groups_data
(groups)¶ Gets aggregated data from a list of groups. Vars are collected in order so, for any groups which define the same var twice, the last group’s value will hold.
-
get_host_data
(hostname)¶ Get data for a single host in this inventory.
-
get_override_data
()¶ Get override data for this inventory.
-
state
= None¶
- names_data – tuple of