title: Use Ansible inventory IP in Playbook
body: <p>I have an inventory file called <code>inventory.ini</code> which contains exactly just:</p>
  
  <pre><code>10.0.0.4
  10.0.0.5
  </code></pre>
  
  <p>I would like to use the IPs listed here in the my Playbook under the variable <code>ip_address</code>:</p>
  
  <pre><code>- name: Import &amp; load configuration file into PAN-OS
    hosts: localhost
    connection: local
    gather_facts: False
  
    vars:
      ip_address: "{{ SOMETHING-GOES-HERE }}"
      username: "#{PALOS_USERNAME}#"
      password: "#{PALOS_PASSWORD}#"
      config_file: ""
      load_file: ""
  
    roles:
    - role: PaloAltoNetworks.paloaltonetworks
  
    tasks:
    - name: wait for reboot
      panos_check:
        ip_address: "{{ ip_address }}"
        username: "{{ username }}"
        password: "{{ password }}"
        interval: 5
        timeout: 900
  
    - name: import configuration file into PAN-OS
      panos_import:
        ip_address: "{{ ip_address }}"
        username: "{{ username }}"
        password: "{{ password }}"
        file: "{{ config_file }}"
        category: "configuration"
  </code></pre>
  
  <p>I have tried using <code>{{ inventory_hostname }}</code>, but that brings back <code>localhost</code> instead. I have also tried using <code>{{ ansible_host }}</code>, but that brings back <code>127.0.0.1</code></p>
  
  <p>Does anyone know how I can use the IPs listed in the inventory in place of the variable as it loops through each deployment?</p>
  
  <p>Just to note, I run the playbook as such:</p>
  
  <pre><code>ansible-playbook panos-config.yml -i inventory.ini --extra-vars "config_file=./xml-config/asdf.xml load_file=asdf.xml" -vvv
  </code></pre>
  
  <p>Ansible version is 2.8.0</p>