<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report and regression, this works fine in 2.1.0</li>
</ul>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.1.1.0"><pre class="notranslate"><code class="notranslate">ansible 2.1.1.0
</code></pre></div>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">Create a directory layout like this:</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
├── ansible.cfg
├── host_vars
│   └── localhost
├── inventory
│   └── hosts
└── playbooks
    └── playbook.yml
"><pre class="notranslate"><span class="pl-s">├── ansible.cfg</span>
<span class="pl-s">├── host_vars</span>
<span class="pl-s">│   └── localhost</span>
<span class="pl-s">├── inventory</span>
<span class="pl-s">│   └── hosts</span>
<span class="pl-s">└── playbooks</span>
    <span class="pl-s">└── playbook.yml</span>
</pre></div>
<p dir="auto">Execute <code class="notranslate">ansible-playbook playbooks/playbook.yml</code> from top level directory and try to use a variable that is defined in <code class="notranslate">host_vars/localhost</code></p>
<p dir="auto">A testcase can be found here: <a href="https://github.com/alvaroaleman/ansible-testcase-group_vars">https://github.com/alvaroaleman/ansible-testcase-group_vars</a></p>
<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible --version
ansible 2.1.1.0
  config file = /stuff/ansible.cfg
  configured module search path = ['./library']"><pre class="notranslate"><code class="notranslate">ansible --version
ansible 2.1.1.0
  config file = /stuff/ansible.cfg
  configured module search path = ['./library']
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<h5 dir="auto">OS / ENVIRONMENT</h5>

<h5 dir="auto">SUMMARY</h5>

<p dir="auto">Just upgraded to ansible 2.1.1 and noticed I could not ssh to any of my nodes anymore. Realized the ssh command that is being used to connect is not including the <code class="notranslate">-o 'IdentityFile=</code> or the <code class="notranslate">-o User=</code> flags. We set the <code class="notranslate">ansible_user</code> and <code class="notranslate">ansible_ssh_private_key_file</code> variables in group_vars for the various environments that each group of hosts is from (typically each environment has a different private_key).</p>
<p dir="auto">Was able to get around this by setting the options on the command line.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>

<p dir="auto">Move ansible_ssh_private_key_file and ansible_user variables to a group_var for a host (mine are not in all.yml, not sure if that matters) and try to run a playbook without specifying the values on the command line.</p>
<p dir="auto">ansible-playbook some_play -vvvv</p>


<h5 dir="auto">EXPECTED RESULTS</h5>

<p dir="auto">This is the result when I add <code class="notranslate">-e ansible_user=ubuntu -e ansible_ssh_private_key_file=~/.ssh/dev.pem</code> to the <code class="notranslate">ansible-playbook</code> command</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;10.64.0.218&gt; SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=360s -o StrictHostKeyChecking=no -o 'IdentityFile=&quot;/home/tkinz/.ssh/dev.pem&quot;' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r 10.64.0.218 '/bin/sh -c '&quot;'&quot;'sudo -H -S -n -u root /bin/sh -c '&quot;'&quot;'&quot;'&quot;'&quot;'&quot;'&quot;'&quot;'echo BECOME-SUCCESS-cjlqfgwiukyslnxpcwrfediwgqapkuwh; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python'&quot;'&quot;'&quot;'&quot;'&quot;'&quot;'&quot;'&quot;' &amp;&amp; sleep 0'&quot;'&quot;''"><pre class="notranslate"><code class="notranslate">&lt;10.64.0.218&gt; SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=360s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/tkinz/.ssh/dev.pem"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r 10.64.0.218 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-cjlqfgwiukyslnxpcwrfediwgqapkuwh; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python'"'"'"'"'"'"'"'"' &amp;&amp; sleep 0'"'"''
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>


<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;10.64.0.218&gt; SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=360s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r 10.64.0.218 '/bin/sh -c '&quot;'&quot;'sudo -H -S -n -u root /bin/sh -c '&quot;'&quot;'&quot;'&quot;'&quot;'&quot;'&quot;'&quot;'echo BECOME-SUCCESS-aefstgpfveqloqbmzzweiirdnbxrrtda; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python'&quot;'&quot;'&quot;'&quot;'&quot;'&quot;'&quot;'&quot;' &amp;&amp; sleep 0'&quot;'&quot;''"><pre class="notranslate"><code class="notranslate">&lt;10.64.0.218&gt; SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=360s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r 10.64.0.218 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-aefstgpfveqloqbmzzweiirdnbxrrtda; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python'"'"'"'"'"'"'"'"' &amp;&amp; sleep 0'"'"''
</code></pre></div>