Let's suppose that we have host group dev with corresponding group vars.
[dev]
host1
host2
How to run ansible playbook with a host3 that is not in group dev using CLI?
ansible
Let's suppose that we have host group dev with corresponding group vars.
[dev]
host1
host2
How to run ansible playbook with a host3 that is not in group dev using CLI?
Best Answer
You can specify a host not in inventory with an extra
-i
. You have to use a comma separated list with a trailing comma to make it work:I don't know how to associate
host3
with a group likedev
from the CLI, so if you've got other stuff in the inventory, you could restrict it like this:Of course, that'll only work if your playbook doesn't explicitly need to reference the
dev
group, and usesall
instead.