TIL how to get a plaintext list of Ansible hosts
There was a need to iterate over the hosts in an Ansible inventory-file (don’t ask). After fiddling around with grep and sed, I found an easier method:
ansible-inventory --list all | jq " ._meta.hostvars| keys[]"
ansible-inventory --list all
lists all hosts including their variables in a nice big json response …