local_action fails to find module in Ansible 2.0 (delegate_to works)

Upgraded to ansible 2.0.0.2 from 1.9.4 and noticed that after creating a new ec2 instance the wait_for module failed when using local_action:

Here’s my play and the output:

  • name: Wait for SSH to come up

local_action:

module: wait_for

host={{ item.public_dns_name }}

port={{ wait_for_port }}

delay=60

state=started

search_regex=OpenSSH

with_items: ec2.instances

fatal: [127.0.0.1]: FAILED! => {“failed”: true, “msg”: “ERROR! The module wait_for host=HIDDEN_IP_ADDRESS.compute-1.amazonaws.com port=22 delay=60 state=started search_regex=OpenSSH was not found in configured module paths. Additionally, core modules are missing. If this is a checkout, run ‘git submodule update --init --recursive’ to correct this problem.”}

However using the delegate_to keyword works: Credit to these guys

  • name: Wait for SSH to come up
    wait_for: >
    host={{ item.public_dns_name }}
    port={{ wait_for_port }}
    delay=60
    state=started
    search_regex=OpenSSH
    with_items: ec2.instances
    delegate_to: localhost

Anyone else have this issue?

You are mixing formats, use yaml or key=val, but not both.