Hello community!
A have plenty of EC2 servers in AWS and want to categorize them based on gathered from ansible_facts (by module setup), for example have group “CentOS” where ansible_facts[‘distribution’] == ‘CentOS’ and so on. But having file “inventory/constructed.yml”:
plugin: constructed
strict: False
keyed_groups:
this creates a group per distro (distro_CentOS, distro_Debian) and assigns the hosts that have matching values to it,
using the default separator “_”
- prefix: distro
key: ansible_distribution
I don’t see this group “distro_CentOS” in output command “ansible-inventory --graph”.
Also this plugin enabled in ansible.cfg:
[inventory]
enable inventory plugins, default: ‘host_list’, ‘script’, ‘auto’, ‘yaml’, ‘ini’, ‘toml’
enable_plugins = host_list, ini, aws_ec2, constructed
How I can sort instances EC2 based on gathered ansible’s facts, avoiding tag each instance?