Search code examples
amazon-web-servicesamazon-ec2ansibleansible-inventory

How to use instance id instead of tag_Name with the dynamic inventory (Ansible)?


I would like to run a command like "ansible -i ec2.py -m ping --limit instance_id_i-123123" instead of "ansible -i ec2.py -m ping --limit tag_Name_test".

I tried id, instance-id and similar with no success. It gives me the error "no hosts matched".


Solution

  • I found the answer. Simply use "... --limit instance-id". e.g.: "ansible -i ec2.py -m ping --limit i-123123123"