[Regression] Implicit localhost with --limit not working in 2.x

It is a very common thing in rolling updates playbooks to run a few tasks on localhost (on the control machine) e.g. to set maintenance in monitoring, to prepare something, etc. So a playbook like this is very common:

`

  • hosts: localhost
    tasks:

  • name: Set Zabbix maintenance
    zabbix_maintenance: …

  • hosts: deploy_group
    tasks:

  • name: Other deploy tasks

  • hosts: localhost
    tasks:

  • name: Set Zabbix maintenance
    zabbix_maintenance: state=absent …

`

And if you want to do this on just one host (or a smaller group of hosts) you would do --limit host01. On 1.9 this worked without a problem and all localhost plays were executed, but on 2.x, --limit doesn’t implicitly include localhost, so you have to use --limit host01,localhost. This is very easy to forget since you are not deploying anything on localhost, it’s not intuitive and if you do forget it, it can be a huge problem, especially in this situation, since maintenance won’t be set so someone would get alerted about a service down, since all plays with localhost will be skipped.

There is a workaround I can think of with using deploy_group instead of localhost, with gather_facts: no, and using delegate_to: localhost with run_once: yes, but that looks like an ugly hack for something which should be very easy to accomplish like e.g. run a command on a control server before deploying any of the servers.

Does anyone know why was this changed in 2.x and are there any plans to return it back? Is there an easy solution to this problem which I’m missing?