aws_ec2 inventory plugins: Creating host variables based on AWS tags

Is there a way to create host variables based on the tags on an instance? (without manually listing each variable and tag under the compose section)

The idea is bascially to allow the equivalent of the INI-style inventory file using tags from AWS. (With the relevant variables using a prefix to identify them)

e.g. If an instance has these tags: (The array syntax is assumed from what works in the INI-style inventory)
ansible_swapfile_size=4G

ansible_extra_packages=[“htop”,“iotop”]

I want these variables to be configured:
swapfile_size: 4G

extra_packages:

  • htop
  • iotop

compose seems to be capable of doing it if I list a fixed set of variables, but that means that if a new variable are added, the inventory would need to be edited.

Is there a way to dynamically generate variables based on tags?

Thanks,
Gert