With ansible-playbook
command , we can execute playbook for all hosts in inventory and I have a playbook which removed cache from webservers. But I shouldn't remove the cache on a particular machine unless Developers requested to do so.
But by using ansible-playbook
I can't pick a specific host from the inventory. But I can use some syntax as ansible-playbook somebook.play -i hostname,
but this looks for DNS entry and execute accordingly but wont check inventory file.
One more way is creating individual inventory file each host and calling them as per requested host by developers, I dont know how much recommended way is this.
Last method AFAIK is using ansible.runner
via Python and using patterns at hostname and calling the python program.
Thanks for reading my long post.
Apart from these , do you know any other ways to pick a specific host/host-group from inventory while executing a playbook ?
I want to know any other ways but by using only ansible-playbook and inventory file.