Ansible hosts and groups when not using a control host

Had a client with a deployment tool that would copy a bundle of Ansible to each host and run ansible-playbook locally on each host defined. This had some interesting side effects where you want to the same play on multiple hosts


[webservers] ansible_connection=local ansible_connection=local

Normally this would force all members of the webservers group to be run locally, so used the following little block:

- hosts: webservers

    - name: foo
        msg: "test message for  -  - "
      when: ansible_host == ansible_hostname