title: Ansible: use host address of hosts.ini in playbook
body: <p>I have to do a POST request with ansible.</p>
  
  <p>My <code>hosts.ini</code> file is:</p>
  
  <pre><code>[workers]
  worker1 ansible_host=111.111.111.111 
  worker2 ansible_host=222.222.222.222 
  </code></pre>
  
  <p>The url I have to connect to needs the ip address of worker1, so I wrote my playbook as:</p>
  
  <pre><code>- hosts: worker1
  
    tasks:
    - name: inizialize worker                                          
      uri:
        url: "http://{{ worker1 }}:8080/xxx/yyy"
        method: POST
        user: admin
        password: password
        force_basic_auth: yes
        return_content: yes
        body: "field=myfield"
  </code></pre>
  
  <p>But running it, I get:</p>
  
  <blockquote>
    <p>the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'worker1' is undefined</p>
  </blockquote>
  
  <p>Where is the problem?</p>