title: Ansible playbook: load internal inventory file while running
body: <p>I hava an inventory file in INI format:</p>
  
  <p>for example:</p>
  
  <pre><code>[db]
  8.8.8.8 ansible_user=root ansible_ssh_private_key_file=/keys/root-id_rsa.pem
  ....
  </code></pre>
  
  <p>I'm looking for a way to <strong>automatically load</strong> my inventory file while running without specify which inventory file path when I triggered my ansible-playbook command</p>
  
  <pre><code>ansible-playbook playbook.yml --inventory-file=hosts (I'm trying to avoid from this) -vv
  </code></pre>
  
  <p>I'm familiar with the "add_host" module but still I prefer to create an inventory file in INI format and somehow to let the playbook  load it automatically. is that possible?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>Thanks to the users @techraf and @Jeff Hemmen I added more details to question</p>
  
  <p>In addition, I don't want to use  either the ansible.cfg file because I want to perform this inside the playbook.yml file itself and not from outside </p>
  
  <p>something like:</p>
  
  <pre><code>- name: add_host {{environment_type}} db servers
    hosts: localhost
    vars_files:
       - vars/main.yml
    roles:
         - { role: my_role}
    inventory_file: (possible?)
       - inventory/hosts.ini (possible?)
  </code></pre>