Local_action module failed.

Hello,

(Ansible version:2.0.0)

I tried to execute the following playbook.

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.

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.

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.