title: Ansible uses wrong host settings
body: <p>Considering the following hosts file:</p>
  
  <pre><code>[initial]
  74.125.224.72 ansible_user=root
  
  [default]
  74.125.224.72 ansible_user=deploy ansible_port=2222
  </code></pre>
  
  <p>I have one playbook called <em>initial.yml</em> with <code>hosts: initial</code> and another called <em>site.yml</em> with <code>hosts: default</code>.</p>
  
  <p>The problem is that if I run <code>ansible-playbook initial.yml</code>, it fails while trying to login as user deploy on port 2222. Shouldn't it just login as user root on port 22?</p>
  
  <p>The contents of <em>initial.yml</em> (commenting out the roles makes no difference either):</p>
  
  <pre><code>---
  - hosts: initial
    roles:
      - { role: common, tags: common }
      - { role: login, tags: login }
  </code></pre>
  
  <p>The contents of <code>ansible.cfg</code>:</p>
  
  <pre><code>[defaults]
  inventory = ./hosts.ini
  roles_path = ./.tmp
  retry_files_enabled = False
  </code></pre>
  
  <p><strong>Environment:</strong></p>
  
  <ul>
  <li>Ansible 2.3.1.0</li>
  <li>Python 2.7.13</li>
  <li>Ubuntu 17.04</li>
  </ul>
  
  <p>Files under <code>/etc/ansible/</code> or <code>/etc/ssh/</code> have not been modified.</p>
  
  <p><strong>EDIT:</strong> I have been able to workaround this issue by using a different <em>hosts</em> file for <em>initial.yml</em>, and specifying it with <code>ansible-playbook --inventory-file=initial.ini</code>.</p>