Constructed Inventory, based off hostvar?

Latest response

Ok so a few weeks back I built a constructed inventory based off existing inventories: aws and vcenter.
I manually edited half a dozen hosts between both source inventories and added the variable:
"websites": ".domain.com"

The constructed inventories source vars are:


plugin: constructed
strict: false
use_extra_vars: true
use_vars_plugins: true
compose:
url: websites
groups:
web_servers: websites is defined

Now initially when I was tweaking these source vars it incorrectly brought in all 46 groups from the source inventories.. all of which were empty.
Finally lucking into the correct syntax above, the hosts added to this new inventory were the 6 I manually added the websites var to.
But since there's no way (that I know of) to clean up empty groups.. I deleted the new constructed inventory and re-created it.
Except now.. a sync pulls in all 190 hosts and 46 groups from the two source inventories!
Same source vars.. but now it doesn't work correctly.

Anyone know if this should be possible.. to base an inventory off the mere existence of a variable?

Responses