{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/14545","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/14545/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/14545/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/14545/events","html_url":"https://github.com/ansible/ansible/issues/14545","id":134455463,"number":14545,"title":"Symlink problem with group_vars","user":{"login":"jim-barber","id":522210,"avatar_url":"https://avatars.githubusercontent.com/u/522210?v=3","gravatar_id":"","url":"https://api.github.com/users/jim-barber","html_url":"https://github.com/jim-barber","followers_url":"https://api.github.com/users/jim-barber/followers","following_url":"https://api.github.com/users/jim-barber/following{/other_user}","gists_url":"https://api.github.com/users/jim-barber/gists{/gist_id}","starred_url":"https://api.github.com/users/jim-barber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jim-barber/subscriptions","organizations_url":"https://api.github.com/users/jim-barber/orgs","repos_url":"https://api.github.com/users/jim-barber/repos","events_url":"https://api.github.com/users/jim-barber/events{/privacy}","received_events_url":"https://api.github.com/users/jim-barber/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible/labels/bug_report","name":"bug_report","color":"fbca04"}],"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/stable-2.0","labels_url":"https://api.github.com/repos/ansible/ansible/milestones/5/labels","id":975800,"number":5,"title":"stable-2.0","description":"","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":156,"closed_issues":813,"state":"open","created_at":"2015-02-11T19:43:06Z","updated_at":"2016-02-24T18:11:33Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2016-02-18T01:39:41Z","updated_at":"2016-02-24T18:11:39Z","closed_at":"2016-02-24T18:11:33Z","body":"##### Issue Type:\r\n\r\n  - Bug Report\r\n\r\n##### Ansible Version:\r\n\r\n```\r\n$ ansible --version\r\nansible 2.0.0.2\r\n  config file = /etc/ansible/ansible.cfg\r\n  configured module search path = Default w/o overrides\r\n```\r\n\r\nInstalled via the Debian package on Debian 'testing' distribution\r\n\r\n```\r\n$ dpkg --list ansible\r\nDesired=Unknown/Install/Remove/Purge/Hold\r\n| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend\r\n|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)\r\n||/ Name                        Version            Architecture       Description\r\n+++-===========================-==================-==================-===========================================================\r\nii  ansible                     2.0.0.2-2          all                Configuration management, deployment, and task execution sy\r\n```\r\n\r\n\r\n##### Ansible Configuration:\r\n\r\n```\r\nforks          = 10\r\nansible_managed = Ansible managed: Do NOT manually edit.\r\nno_target_syslog = True\r\nssh_args = -o ControlMaster=auto -o ControlPersist=30m\r\npipelining = True\r\n```\r\n\r\n##### Environment:\r\n\r\nDebian Linux: 'testing' distribution.\r\n\r\n```\r\n$ cat /etc/debian_version \r\nstretch/sid\r\n```\r\n\r\n```\r\n$ cat /etc/apt/sources.list\r\n# Ansible managed: Do NOT manually edit.\r\n\r\ndeb http://ftp.au.debian.org/debian/ testing main non-free contrib\r\n\r\ndeb http://security.debian.org/ testing/updates main non-free contrib\r\n```\r\n\r\n##### Summary:\r\n\r\nThe group_vars are not working when symlinks are used.\r\nThis used to work well for Ansible 1.9.x, but since upgrading to Ansible 2.0.0.2 it stopped working.\r\n\r\n##### Steps To Reproduce:\r\n\r\nExample configuration where it doesn't work.\r\n\r\nA recursive ls showing directories, files, and symlink:\r\n\r\n```\r\n$ ls -lR\r\n.:\r\ntotal 12\r\ndrwxr-xr-x 4 jimb jimb 4096 Feb 18 09:05 group_vars/\r\n-rw-r--r-- 1 jimb jimb   29 Feb 18 09:03 hosts\r\n-rw-r--r-- 1 jimb jimb   84 Feb 18 09:07 main.yml\r\n\r\n./group_vars:\r\ntotal 8\r\ndrwxr-xr-x 2 jimb jimb 4096 Feb 18 09:05 all/\r\ndrwxr-xr-x 2 jimb jimb 4096 Feb 18 09:05 alternate/\r\nlrwxrwxrwx 1 jimb jimb    9 Feb 18 09:05 bug-report -> alternate/\r\n\r\n./group_vars/all:\r\ntotal 4\r\n-rw-r--r-- 1 jimb jimb 27 Feb 18 09:05 vars.yml\r\n\r\n./group_vars/alternate:\r\ntotal 4\r\n-rw-r--r-- 1 jimb jimb 33 Feb 18 09:05 vars.yml\r\n```\r\n\r\nContents of the hosts file:\r\n\r\n```\r\n$ cat hosts \r\n[bug-report]\r\n        jim-tmp.hc.int\r\n```\r\n\r\nContents of the playbook:\r\n\r\n```\r\n$ cat main.yml \r\n---\r\n- hosts: all\r\n\r\n  tasks:\r\n\r\n  - name: Debug variable\r\n    debug:\r\n      var: variable\r\n```\r\n\r\nContent of the variable defined for the 'all' group:\r\n\r\n```\r\n$ cat group_vars/all/vars.yml \r\n---\r\nvariable: 'all group'\r\n```\r\n\r\nContent of the variable defined in the 'alternate' group, but via the 'bug-report' symlink which matches the host group:\r\n\r\n```\r\n$ cat group_vars/bug-report/vars.yml \r\n---\r\nvariable: 'alternate group'\r\n```\r\n\r\n##### Expected Results:\r\n\r\n```\r\n$ ansible-playbook -i hosts main.yml \r\n\r\nPLAY ***************************************************************************\r\n\r\nTASK [setup] *******************************************************************\r\nok: [jim-tmp.hc.int]\r\n\r\nTASK [Debug variable] **********************************************************\r\nok: [jim-tmp.hc.int] => {\r\n    \"variable\": \"alternate group\"\r\n}\r\n\r\nPLAY RECAP *********************************************************************\r\njim-tmp.hc.int             : ok=2    changed=0    unreachable=0    failed=0   \r\n```\r\n\r\nNote that I got the Actual Results below first using the Steps to Reproduce setup above.\r\nThen to get the Expected Results above I removed the symlink and copied group_vars/alternate to group_vars/bug-report like so:\r\n\r\n```\r\n$ rm group_vars/bug-report\r\n$ cp -a group_vars/alternate group_vars/bug-report\r\n$ ls -l group_vars/\r\ntotal 12\r\ndrwxr-xr-x 2 jimb jimb 4096 Feb 18 09:05 all/\r\ndrwxr-xr-x 2 jimb jimb 4096 Feb 18 09:05 alternate/\r\ndrwxr-xr-x 2 jimb jimb 4096 Feb 18 09:05 bug-report/\r\n```\r\n\r\n##### Actual Results:\r\n\r\n```\r\n$ ansible-playbook -i hosts main.yml \r\n\r\nPLAY ***************************************************************************\r\n\r\nTASK [setup] *******************************************************************\r\nok: [jim-tmp.hc.int]\r\n\r\nTASK [Debug variable] **********************************************************\r\nok: [jim-tmp.hc.int] => {\r\n    \"variable\": \"all group\"\r\n}\r\n\r\nPLAY RECAP *********************************************************************\r\njim-tmp.hc.int             : ok=2    changed=0    unreachable=0    failed=0   \r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/188387424","html_url":"https://github.com/ansible/ansible/issues/14545#issuecomment-188387424","issue_url":"https://api.github.com/repos/ansible/ansible/issues/14545","id":188387424,"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":"2016-02-24T18:11:39Z","updated_at":"2016-02-24T18:11:39Z","body":"Closing This Ticket\n===================\n\nHi!\n\nWe believe the above commit should resolve this problem for you. This will also be included in the next release.\n\nIf you continue seeing any problems related to this issue, or if you have any further questions, please let us know by stopping by one of the two mailing lists, as appropriate:\n\n   * https://groups.google.com/forum/#!forum/ansible-project - for user questions, tips, and tricks\n   * https://groups.google.com/forum/#!forum/ansible-devel - for strategy, future planning, and questions about writing code\n\nBecause this project is very active, we're unlikely to see comments made on closed tickets, but the mailing list is a great way to ask questions, or post if you don't think this particular issue is resolved.\n\nThank you!"}}