class

Krikri::InventoryPlugins

Inherits Reference < Object

YAML-defined inventory plugins (plugin: <name> at the top level of an inventory YAML file), the format real Ansible uses for both its built-in sources (host_list, constructed, ini, yaml) and collection plugins (amazon.aws.aws_ec2).

Detection is by the top-level plugin key, same as real Ansible. The collection prefix is stripped ("amazon.aws.aws_ec2" dispatches on "aws_ec2"), so a plugin from any collection whose final segment matches a supported name is handled here.

aws_ec2 talks to the real EC2 API with SigV4-signed HTTP (via awscr-signer) rather than shelling out to the aws CLI: real Ansible only needs boto3 on the controller, and this needs nothing but the two credential environment variables. The DescribeInstances response is parsed from XML and mapped to hosts, then run through the same constructed-style option machinery (compose/keyed_groups/groups/filters) that the aws_ec2 plugin is itself built on in real Ansible - which is also what the standalone constructed plugin uses.

Constants

SUPPORTED_PLUGINS = ["host_list", "ini", "yaml", "constructed", "aws_ec2"] of ::String

Class methods

apply_constructed_options(inventory : Inventory, doc : YAML::Any) : Inventory

The constructed-style option machinery shared by the constructed plugin and aws_ec2: filters, keyed_groups, groups and compose, applied to every host already in inventory.

Source
build_aws_ec2_hosts(inventory : Inventory, xml : String, options : YAML::Any, region : String) : Nil

Build hosts from a DescribeInstances XML response. Split out from parse_aws_ec2 so specs can exercise the mapping without network.

Source
constructed_source?(path : String) : Bool

True when path is a YAML inventory source whose plugin is constructed. Used by directory parsing: constructed sources do not contribute hosts themselves, they transform hosts contributed by the OTHER sources in the same directory, so they must be applied after every other source is merged (real Ansible behaves the same way).

Source
parse_plugin(path : String, doc : YAML::Any, name : String, existing : Inventory | Nil = nil) : Inventory
Source
plugin_name(doc : YAML::Any) : String | Nil

The plugin name a YAML inventory document dispatches on, with any collection prefix stripped; nil when the document is not a plugin source (no top-level plugin key).

Source