Discussion in 3 parts.
(A)
I'm sure this will be slightly unpopular, but --override-hosts needs to go.
As some of you are aware, override hosts was actually broken on devel for a few days. I just spent a few hours trying to fix it and came to an unexpected conclusion.
It's incompatible with the new inventory API if we assume that override hosts should also retain group info and at the same time represent hosts not in inventory. Not incompatible, but it has a code cost that I'd judge "not worth it"
(B)
If you're using this feature, don't panic.
As restricting to certain hosts was a useful use case, I am proposing making the following work instead:
ansible-playbook all --extra-vars="group=stage"
And in the playbook:
hosts: $group
If you have stage_webservers and prod_webservers, this can be two groups. Seems easy enough to me, and if you don't like that, you can pass in any hosts you like. This is universal, it's always going to work, and it's a lot less specialized than --override-hosts.
(C)
The only case it doesn't cover is managing a host NOT in inventory, but having a playbook named 'all' just to make that work is weird. Because if you ran that playbook without --override-hosts it would run against everything, and that's destructive anyway.
So I think adding the playbook to inventory isn't terrible.
If this bothers you, TECHNICALLY, you could wrap ansible-playbook in a really dumb script and achieve exactly what --override-hosts does.
cat hostname > /tmp/inventory
ansible-playbook foo.yml -i /tmp/inventory
Because you can already support multiple inventory files with -i.
--Michael