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

**URL:** <https://forum.ansible.com/t/regression-implicit-localhost-with-limit-not-working-in-2-x/22082>\
**Category:** Ansible Developer\
**Created:** [July 21, 2016, 9:52pm UTC](https://forum.ansible.com/t/regression-implicit-localhost-with-limit-not-working-in-2-x/22082 "2016-07-21T21:52:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Strahinja\_Kustudic1](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@Strahinja\_Kustudic1](https://forum.ansible.com/u/Strahinja_Kustudic1)\
**Post date:** [July 21, 2016, 9:52pm UTC](https://forum.ansible.com/t/regression-implicit-localhost-with-limit-not-working-in-2-x/22082/1 "2016-07-21T21:52:34Z")

</div>

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?
