I am trying to play a yml on other host than configured, using -l option.. but skipping: no hosts matched
.
The scenario is where a host associated playbook is needed to be exceptionally used for some other host. (and for safety reasons, the playbook cannot have hosts:all and be left to the admin to limit the target(s))
What is the correct way to do this (if there is any)?
L.E. So, in the end, the answer of @mdaniel gave me the idea o a bash wrapper that creates a temp yml where the host: field is replaced with the argument.. it's not pretty but it works. (same works for a dynamical generation of a playbook from a series of tasks) and the proper ansible way to do it i just found it here: https://stackoverflow.com/a/18195217/624734
What is the correct way to do this?
Use all
as the target of the playbook, and then constrain the hosts it applies to via the inventory, or the --limit
that you mentioned
- hosts: all
# and now the rest of your playbook