# Local\_action module failed.

**URL:** <https://forum.ansible.com/t/local-action-module-failed/20952>\
**Category:** Ansible Project\
**Created:** [March 22, 2016, 7:18am UTC](https://forum.ansible.com/t/local-action-module-failed/20952 "2016-03-22T07:18:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yuri](https://avatars.discourse-cdn.com/v4/letter/y/71c47a/32.png) [@Yuri](https://forum.ansible.com/u/Yuri)\
**Post date:** [March 22, 2016, 7:18am UTC](https://forum.ansible.com/t/local-action-module-failed/20952/1 "2016-03-22T07:18:55Z")

</div>

Hello,

(Ansible version:2.0.0)

I tried to execute the following playbook.

---

<div class="post-metadata">

**Author:** ![Uditha\_Desilva](https://avatars.discourse-cdn.com/v4/letter/u/f475e1/32.png) [@Uditha\_Desilva](https://forum.ansible.com/u/Uditha_Desilva)\
**Post date:** [March 22, 2016, 4:28pm UTC](https://forum.ansible.com/t/local-action-module-failed/20952/2 "2016-03-22T16:28:21Z")

</div>

What’s wrong with doing it via inventory?

I suppose you could try explicitly setting

hostvars.[‘localhost’].ansible\_connection\_method=“local”

as a workaround.

Uditha.

---

<div class="post-metadata">

**Author:** ![Yuri](https://avatars.discourse-cdn.com/v4/letter/y/71c47a/32.png) [@Yuri](https://forum.ansible.com/u/Yuri)\
**Post date:** [March 23, 2016, 4:38am UTC](https://forum.ansible.com/t/local-action-module-failed/20952/3 "2016-03-23T04:38:47Z")

</div>

Thank you for reply.

> What’s wrong with doing it via inventory?

Installed OS in a host varies by timing, so I’m trying to prepare the following two playbooks.  
playbook\_windows.yml : “ansible\_connection: winrm” in vars section  
playbook\_linux.yml : “ansible\_connection: ssh” in vars section  
This is why I don’t want to doing it via inventory.

> I suppose you could try explicitly setting

> hostvars.[‘localhost’].ansible\_connection\_method=“local”

> as a workaround.

I tried the following playbook, but invalid variable name error occuerd.

---

<div class="post-metadata">

**Author:** ![Uditha\_Desilva](https://avatars.discourse-cdn.com/v4/letter/u/f475e1/32.png) [@Uditha\_Desilva](https://forum.ansible.com/u/Uditha_Desilva)\
**Post date:** [March 23, 2016, 1:26pm UTC](https://forum.ansible.com/t/local-action-module-failed/20952/4 "2016-03-23T13:26:31Z")

</div>

That doesn’t seem to be an argument vs. making it an inventory variable (specifically, a group variable, if you’re creating a group of windows hosts) – otherwise how are you distinguishing between your managed systems at all? separate inventory files?

setting the hostvar entry doesn’t seem to be supported because templating is essentially a one-way process.
