Hi all,
Is there a way to select hosts in inventory based on a variable ?
More specifically, I have a host file like :
[webservers]
web1.example.com location=room1
web2.example.com location=room1
web3.example.com location=room22
[dbservers]
db1.example.com location=room22
db2.example.com location=room1
db3.example.comI would like to be able to select all computers with location=room1 (basically I want to shutdown all these machines because we have to cut the power in this room).
Thus a commande like :
ansible all --list-hosts --filter=location=room1
would be great.
Il could do that more or less in a playbook, but I also use ansible in shell scripts to run specific commands.
F.