pyinfra.connectors.ansible module

Note: this connector is a work in progress! While it parses the list of hosts OK, it doesn’t handle nested groups properly yet.

The @ansible connector can be used to parse Ansible inventory files.

# Load an Ansible inventory relative to the current directory
pyinfra @ansible/path/to/inventory

# Load using an absolute path
pyinfra @ansible//absolute/path/to/inventory
pyinfra.connectors.ansible.append_groups_to_host(host: Host, groups, host_to_groups)
pyinfra.connectors.ansible.make_names_data(inventory_filename: str | None = None)
pyinfra.connectors.ansible.parse_inventory(inventory_filename: str)
pyinfra.connectors.ansible.parse_inventory_ini(inventory_filename: str)
pyinfra.connectors.ansible.parse_inventory_tree(inventory_tree, host_to_groups={}, group_stack={})
pyinfra.connectors.ansible.show_warning()