{"action":"closed","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/38954","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/38954/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/38954/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/38954/events","html_url":"https://github.com/ansible/ansible/issues/38954","id":315514225,"number":38954,"title":"roles with a \"name\" parameter break with ansible 2.5","user":{"login":"sbarthelemy","id":98104,"avatar_url":"https://avatars0.githubusercontent.com/u/98104?v=4","gravatar_id":"","url":"https://api.github.com/users/sbarthelemy","html_url":"https://github.com/sbarthelemy","followers_url":"https://api.github.com/users/sbarthelemy/followers","following_url":"https://api.github.com/users/sbarthelemy/following{/other_user}","gists_url":"https://api.github.com/users/sbarthelemy/gists{/gist_id}","starred_url":"https://api.github.com/users/sbarthelemy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbarthelemy/subscriptions","organizations_url":"https://api.github.com/users/sbarthelemy/orgs","repos_url":"https://api.github.com/users/sbarthelemy/repos","events_url":"https://api.github.com/users/sbarthelemy/events{/privacy}","received_events_url":"https://api.github.com/users/sbarthelemy/received_events","type":"User","site_admin":false},"labels":[{"id":686214011,"url":"https://api.github.com/repos/ansible/ansible/labels/affects_2.5","name":"affects_2.5","color":"ededed","default":false},{"id":785271699,"url":"https://api.github.com/repos/ansible/ansible/labels/bug","name":"bug","color":"fbca04","default":true},{"id":503572087,"url":"https://api.github.com/repos/ansible/ansible/labels/needs_triage","name":"needs_triage","color":"0e8a16","default":false},{"id":636352796,"url":"https://api.github.com/repos/ansible/ansible/labels/support:core","name":"support:core","color":"ededed","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-04-18T14:50:25Z","updated_at":"2018-04-18T15:42:36Z","closed_at":"2018-04-18T15:42:36Z","author_association":"CONTRIBUTOR","body":"##### ISSUE TYPE\r\n<!--- Pick one below and delete the rest -->\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\n<!--- Insert, BELOW THIS COMMENT, the name of the module, plugin, task or feature.\r\ncore\r\n\r\n##### ANSIBLE VERSION\r\n<!--- Paste, BELOW THIS COMMENT, verbatim output from \"ansible --version\" between quotes below -->\r\n```\r\nansible 2.5.0\r\n  config file = None\r\n  configured module search path = [u'/home/sbarthelemy/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']\r\n  ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible\r\n  executable location = /usr/local/bin/ansible\r\n  python version = 2.7.13 (default, Nov 24 2017, 17:33:09) [GCC 6.3.0 20170516]\r\n```\r\n\r\n##### CONFIGURATION\r\n<!--- If using Ansible 2.4 or above, paste, BELOW THIS COMMENT, the results of \"ansible-config dump --only-changed\"\r\nOtherwise, mention any settings you have changed/added/removed in ansible.cfg\r\n(or using the ANSIBLE_* environment variables).-->\r\n\r\n##### OS / ENVIRONMENT\r\n<!--- Mention, BELOW THIS COMMENT, the OS you are running Ansible from, and the OS you are\r\nmanaging, or say \"N/A\" for anything that is not platform-specific.\r\nAlso mention the specific version of what you are trying to control,\r\ne.g. if this is a network bug the version of firmware on the network device.-->\r\ndebian stretch\r\n\r\n##### SUMMARY\r\nroles with a parameter named \"name\" \r\n* worked fine when used in the \"classic\" way with ansible v2.3 and v2.4, but fail with ansible v2.5.0.\r\n* worked fine when used as an \"include_role\" task with ansible v2.3, but have the \"name\" parameter shadowed with ansible v2.4 and v2.5.0.\r\n\r\n##### STEPS TO REPRODUCE\r\n<!--- For bugs, show exactly how to reproduce the problem, using a minimal test-case.\r\nFor new features, show how the feature would be used. -->\r\n\r\n<!--- Paste example playbooks or commands between quotes below -->\r\n```\r\n$ cat main.yaml\r\n- hosts: localhost\r\n  tasks:\r\n  - include_role:\r\n      name: rolewithnameparam\r\n    vars:\r\n      name: MyNameFromIncludeRole\r\n      extra: ExtraFromIncludeRole\r\n  roles:\r\n  - role: rolewithnameparam\r\n    name: MyNameFromClassicRole\r\n    extra: ExtraFromClassicRole\r\n```\r\n```\r\n$ cat roles/rolewithnameparam/tasks/main.yaml\r\n- debug:\r\n    msg: \"hi name is \\\"{{ name }}\\\" extra is \\\" {{ extra }}\\\"\"\r\n```\r\n```\r\n$ ansible-playbook main.yaml\r\n```\r\n<!--- You can also paste gist.github.com links for larger files -->\r\n\r\n##### EXPECTED RESULTS\r\n<!--- What did you expect to happen when running the steps above? -->\r\n\r\nI explect the playbook to run with success, and to display (in the debug message) the parameters provided in the main playbook.\r\nThis is the behavior ansible 2.3 and 2.4 do exhibit.\r\n```\r\n$ ansible --version\r\nansible 2.3.4.0\r\n  config file =\r\n  configured module search path = Default w/o overrides\r\n  python version = 2.7.13 (default, Nov 24 2017, 17:33:09) [GCC 6.3.0 20170516]\r\n```\r\n```\r\n$ ansible-playbook main.yaml\r\n [WARNING]: Host file not found: /etc/ansible/hosts\r\n [WARNING]: provided hosts list is empty, only localhost is available\r\nPLAY [localhost] *********************************************************************************************************\r\nTASK [Gathering Facts] ***************************************************************************************************\r\nok: [localhost]\r\nTASK [rolewithnameparam : debug] *****************************************************************************************\r\nok: [localhost] => {\r\n    \"msg\": \"hi name is \\\"MyNameFromClassicRole\\\" extra is \\\" ExtraFromClassicRole\\\"\"\r\n}\r\nTASK [rolewithnameparam : debug] *****************************************************************************************\r\nok: [localhost] => {\r\n    \"msg\": \"hi name is \\\"MyNameFromIncludeRole\\\" extra is \\\" ExtraFromIncludeRole\\\"\"\r\n}\r\nPLAY RECAP ***************************************************************************************************************\r\nlocalhost                  : ok=3    changed=0    unreachable=0    failed=0\r\n```\r\n\r\n\r\n##### ACTUAL RESULTS\r\n<!--- What actually happened? If possible run with extra verbosity (-vvvv) -->\r\n\r\n###### With ansible 2.5.0\r\n\r\nthe playbook execution fails.\r\n\r\n<!--- Paste verbatim command output between quotes below -->\r\n```\r\n$ ansible --version\r\nansible 2.5.0\r\n  config file = None\r\n  configured module search path = [u'/home/sbarthelemy/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']\r\n  ansible python module location = /home/sbarthelemy/ar/2018/ansible25roles/adev/local/lib/python2.7/site-packages/ansible\r\n  executable location = /home/sbarthelemy/ar/2018/ansible25roles/adev/bin/ansible\r\n  python version = 2.7.13 (default, Nov 24 2017, 17:33:09) [GCC 6.3.0 20170516]\r\n\r\n\r\n$ ansible-playbook main.yaml\r\n [WARNING]: Unable to parse /etc/ansible/hosts as an inventory source\r\n [WARNING]: No inventory was parsed, only implicit localhost is available\r\n [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match\r\n'all'\r\nPLAY [localhost] *********************************************************************************************************\r\nTASK [Gathering Facts] ***************************************************************************************************\r\nok: [localhost]\r\nTASK [rolewithnameparam : debug] *****************************************************************************************\r\nfatal: [localhost]: FAILED! => {\"msg\": \"The task includes an option with an undefined variable. The error was: 'name' is undefined\\n\\nThe error appears to have been in '/home/sbarthelemy/ar/2018/ansible25roles/roles/rolewithnameparam/tasks/main.yaml': line 1, column 3, but may\\nbe elsewhere in the file depending on the exact syntax problem.\\n\\nThe offending line appears to be:\\n\\n\\n- debug:\\n  ^ here\\n\"}\r\n        to retry, use: --limit @/home/sbarthelemy/ar/2018/ansible25roles/main2.retry\r\nPLAY RECAP ***************************************************************************************************************\r\nlocalhost                  : ok=1    changed=0    unreachable=0    failed=1\r\n```\r\n\r\n###### With ansible 2.4\r\n\r\nwhen the role is used from an `include_role` task, the `name` variable is shadowed by the role name.\r\n\r\n```\r\n$ ansible --version\r\nansible 2.4.4.0\r\n  config file = None\r\n  configured module search path = [u'/home/sbarthelemy/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']\r\n  ansible python module location = /home/sbarthelemy/ar/2018/ansible25roles/adev/local/lib/python2.7/site-packages/ansible\r\n  executable location = /home/sbarthelemy/ar/2018/ansible25roles/adev/bin/ansible\r\n  python version = 2.7.13 (default, Nov 24 2017, 17:33:09) [GCC 6.3.0 20170516]\r\n```\r\n```\r\n$ ansible-playbook main.yaml\r\n [WARNING]: Unable to parse /etc/ansible/hosts as an inventory source\r\n [WARNING]: No inventory was parsed, only implicit localhost is available\r\n [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match\r\n'all'\r\nPLAY [localhost] *********************************************************************************************************\r\nTASK [Gathering Facts] ***************************************************************************************************\r\nok: [localhost]\r\nTASK [rolewithnameparam : debug] *****************************************************************************************\r\nok: [localhost] => {\r\n    \"msg\": \"hi name is \\\"MyNameFromClassicRole\\\" extra is \\\" ExtraFromClassicRole\\\"\"\r\n}\r\nTASK [include_role] ******************************************************************************************************\r\nTASK [rolewithnameparam : debug] *****************************************************************************************\r\nok: [localhost] => {\r\n    \"msg\": \"hi name is \\\"rolewithnameparam\\\" extra is \\\" ExtraFromIncludeRole\\\"\"\r\n}\r\nPLAY RECAP ***************************************************************************************************************\r\nlocalhost                  : ok=3    changed=0    unreachable=0    failed=0\r\n```"}}
{"actor":{"display_login":"bcoca"}}