# Combining local\_action and delegate\_to

**URL:** <https://forum.ansible.com/t/combining-local-action-and-delegate-to/29840>\
**Category:** Ansible Project\
**Created:** [March 7, 2019, 5:18pm UTC](https://forum.ansible.com/t/combining-local-action-and-delegate-to/29840 "2019-03-07T17:18:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amir\_Al-Shourbaji](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Amir\_Al-Shourbaji](https://forum.ansible.com/u/Amir_Al-Shourbaji)\
**Post date:** [March 7, 2019, 5:18pm UTC](https://forum.ansible.com/t/combining-local-action-and-delegate-to/29840/1 "2019-03-07T17:18:29Z")

</div>

I want this module to run locally on a host i delegate\_to

- name: Add Host to dhcp config  
local\_action:  
module: lineinfile  
dest: /etc/dhcp/dhcpd.conf  
line: “host {{ inventory\_hostname}} {hardware ethernet {{ macaddress }};fixed-address {{ inventory\_hostname}}; }”  
notify: restart dhcpd

delegate\_to: anarbitraryhost

Doesn’t seem to work - are local\_action and delegate\_to mutually exclusive?

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [March 7, 2019, 5:22pm UTC](https://forum.ansible.com/t/combining-local-action-and-delegate-to/29840/2 "2019-03-07T17:22:31Z")

</div>

local\_action is the same as delegate\_to: localhost.  
So you can't use them together since it gives no meaning, either you want it to run on localhost or anarbitraryhost.

If you want to run in on both you need two tasks.
