title: Run ansible-playbook from localhost, and using vars from hosts file
body: <p>Let's say that I want to run something locally. but I want to use the vars from the hosts file, so basically - I want to do for each line something locally.</p>
  
  <p>In this example, I want to use ec2_tag from ansible.</p>
  
  <p>hosts file for ansible playbook run:</p>
  
  <p><code>[any]
   123.123.123.123 region=eu-region ec2_instance_id=x-xxxxxxxxxxxxxxxxx
   123.123.123.124 region=eu-region ec2_instance_id=x-xxxxxxxxxxxxxxxxx</code></p>
  
  <p>ansible-playbook:</p>
  
  <pre><code>- name: something
    hosts: any
    tasks:
  
    - name: test
      ec2_tag:
        region: "{{ region }}"
        resource: "{{ ec2_instance_id }}""
        state: list
      register: ec2_tags
  
    - debug: msg={{ ec2_tags }}
  </code></pre>
  
  <p>How can i loop localy on <code>[any]</code> vars? let's say get <code>region</code>?</p>