{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/13431","labels_url":"https://api.github.com/repos/ansible/ansible/issues/13431/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/13431/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/13431/events","html_url":"https://github.com/ansible/ansible/issues/13431","id":120408799,"number":13431,"title":"Host variables are not merged appropriately when using inventory directories","user":{"login":"benjixx","id":45906,"avatar_url":"https://avatars.githubusercontent.com/u/45906?v=3","gravatar_id":"","url":"https://api.github.com/users/benjixx","html_url":"https://github.com/benjixx","followers_url":"https://api.github.com/users/benjixx/followers","following_url":"https://api.github.com/users/benjixx/following{/other_user}","gists_url":"https://api.github.com/users/benjixx/gists{/gist_id}","starred_url":"https://api.github.com/users/benjixx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjixx/subscriptions","organizations_url":"https://api.github.com/users/benjixx/orgs","repos_url":"https://api.github.com/users/benjixx/repos","events_url":"https://api.github.com/users/benjixx/events{/privacy}","received_events_url":"https://api.github.com/users/benjixx/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible/labels/bug_report","name":"bug_report","color":"fbca04"},{"url":"https://api.github.com/repos/ansible/ansible/labels/needs_info","name":"needs_info","color":"eb6420"},{"url":"https://api.github.com/repos/ansible/ansible/labels/pending_closure","name":"pending_closure","color":"e11d21"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/ansible/ansible/milestones/5","html_url":"https://github.com/ansible/ansible/milestones/v2","labels_url":"https://api.github.com/repos/ansible/ansible/milestones/5/labels","id":975800,"number":5,"title":"v2","description":null,"creator":{"login":"bcoca","id":836171,"avatar_url":"https://avatars.githubusercontent.com/u/836171?v=3","gravatar_id":"","url":"https://api.github.com/users/bcoca","html_url":"https://github.com/bcoca","followers_url":"https://api.github.com/users/bcoca/followers","following_url":"https://api.github.com/users/bcoca/following{/other_user}","gists_url":"https://api.github.com/users/bcoca/gists{/gist_id}","starred_url":"https://api.github.com/users/bcoca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcoca/subscriptions","organizations_url":"https://api.github.com/users/bcoca/orgs","repos_url":"https://api.github.com/users/bcoca/repos","events_url":"https://api.github.com/users/bcoca/events{/privacy}","received_events_url":"https://api.github.com/users/bcoca/received_events","type":"User","site_admin":false},"open_issues":24,"closed_issues":569,"state":"open","created_at":"2015-02-11T19:43:06Z","updated_at":"2015-12-04T19:28:31Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-12-04T14:09:29Z","updated_at":"2015-12-04T19:45:17Z","closed_at":"2015-12-04T19:22:20Z","body":"##### Issue Type:\r\n\r\nBug Report\r\n\r\n##### Ansible Version:\r\n\r\nansible devel\r\n\r\n##### Ansible Configuration:\r\n\r\nno changes\r\n\r\n##### Environment:\r\n\r\nMac OS X 10.11.1\r\n\r\n##### Summary:\r\n\r\nHost variables are not merged appropriately when using inventory directories.\r\n\r\n##### Steps To Reproduce:\r\n\r\n```\r\n$ find . -type f | xargs -n1 -t cat\r\ncat ./inventory1\r\ntesthost ansible_connection=local\r\n\r\ncat ./inventory2\r\n[test-hosts]\r\ntesthost ansible_connection=local\r\n\r\ncat ./inventory3/dynamic\r\ntesthost ansible_connection=local\r\n\r\ncat ./inventory3/static\r\n[test-hosts]\r\ntesthost\r\n\r\ncat ./playbook1.yml\r\n- hosts: testhost\r\n  tasks:\r\n    - name: host is reachable\r\n      ping:\r\n\r\ncat ./playbook2.yml\r\n- hosts: test-hosts\r\n  tasks:\r\n    - name: host is reachable\r\n      ping:\r\n\r\ncat ./playbook3.yml\r\n- hosts: test-hosts\r\n  tasks:\r\n    - name: host is reachable\r\n      ping:\r\n\r\n$ ansible-playbook -i ./inventory1 ./playbook1.yml\r\n\r\nPLAY ***************************************************************************\r\n\r\nTASK [setup] *******************************************************************\r\nok: [testhost]\r\n\r\nTASK [host is reachable] *******************************************************\r\nok: [testhost]\r\n\r\nPLAY RECAP *********************************************************************\r\ntesthost                   : ok=2    changed=0    unreachable=0    failed=0\r\n\r\n$ ansible-playbook -i ./inventory2 ./playbook2.yml\r\n\r\nPLAY ***************************************************************************\r\n\r\nTASK [setup] *******************************************************************\r\nok: [testhost]\r\n\r\nTASK [host is reachable] *******************************************************\r\nok: [testhost]\r\n\r\nPLAY RECAP *********************************************************************\r\ntesthost                   : ok=2    changed=0    unreachable=0    failed=0\r\n\r\n$ ansible-playbook -i ./inventory3 ./playbook3.yml\r\n\r\nPLAY ***************************************************************************\r\n\r\nTASK [setup] *******************************************************************\r\nfatal: [testhost]: UNREACHABLE! => {\"changed\": false, \"msg\": \"ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue\", \"unreachable\": true}\r\n\r\nPLAY RECAP *********************************************************************\r\ntesthost                   : ok=0    changed=0    unreachable=1    failed=0\r\n```\r\n\r\n##### Expected Results:\r\n\r\nI would expect all three ``ansible-playbook`` to return the same output without any errors.\r\n\r\n##### Actual Results:\r\n\r\nThird test with inventory directory fails as it tries to use SSH connection. This is very likely again an issue with host variables not being merged correctly.\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/162063827","html_url":"https://github.com/ansible/ansible/issues/13431#issuecomment-162063827","issue_url":"https://api.github.com/repos/ansible/ansible/issues/13431","id":162063827,"user":{"login":"jimi-c","id":26403,"avatar_url":"https://avatars.githubusercontent.com/u/26403?v=3","gravatar_id":"","url":"https://api.github.com/users/jimi-c","html_url":"https://github.com/jimi-c","followers_url":"https://api.github.com/users/jimi-c/followers","following_url":"https://api.github.com/users/jimi-c/following{/other_user}","gists_url":"https://api.github.com/users/jimi-c/gists{/gist_id}","starred_url":"https://api.github.com/users/jimi-c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimi-c/subscriptions","organizations_url":"https://api.github.com/users/jimi-c/orgs","repos_url":"https://api.github.com/users/jimi-c/repos","events_url":"https://api.github.com/users/jimi-c/events{/privacy}","received_events_url":"https://api.github.com/users/jimi-c/received_events","type":"User","site_admin":false},"created_at":"2015-12-04T19:45:17Z","updated_at":"2015-12-04T19:45:17Z","body":"Great, thanks for the follow-up!"}}