{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/14850","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/14850/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/14850/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/14850/events","html_url":"https://github.com/ansible/ansible/issues/14850","id":139053269,"number":14850,"title":"Iterating over multiple includes fails","user":{"login":"windowsrefund","id":512222,"avatar_url":"https://avatars.githubusercontent.com/u/512222?v=3","gravatar_id":"","url":"https://api.github.com/users/windowsrefund","html_url":"https://github.com/windowsrefund","followers_url":"https://api.github.com/users/windowsrefund/followers","following_url":"https://api.github.com/users/windowsrefund/following{/other_user}","gists_url":"https://api.github.com/users/windowsrefund/gists{/gist_id}","starred_url":"https://api.github.com/users/windowsrefund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/windowsrefund/subscriptions","organizations_url":"https://api.github.com/users/windowsrefund/orgs","repos_url":"https://api.github.com/users/windowsrefund/repos","events_url":"https://api.github.com/users/windowsrefund/events{/privacy}","received_events_url":"https://api.github.com/users/windowsrefund/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-07T18:23:43Z","updated_at":"2016-03-08T19:22:58Z","closed_at":null,"body":"##### Issue Type:\r\n\r\n - Bug Report\r\n\r\n##### Ansible Version:\r\n\r\n```\r\nansible 2.1.0 (fix-ec2-group-rules 283532e11d) last updated 2016/02/22 15:03:06 (GMT -400)\r\n```\r\n\r\n##### Ansible Configuration:\r\n\r\nN/A\r\n\r\n##### Environment:\r\n\r\nN/A\r\n\r\n##### Summary:\r\n\r\nitem is not overwritten on the second level of include\r\n\r\n##### Steps To Reproduce:\r\n\r\ntest1.yml\r\n```\r\n---                                                                            \r\n- name: Looping with includes test                                              \r\n  hosts: localhost                                                              \r\n  connection: local                                                            \r\n  become: False                                                                \r\n  gather_facts: no                                                              \r\n  tasks:                                                                        \r\n    - include: test2.yml                                                        \r\n      with_items:                                                              \r\n        - foo:                                                                  \r\n          - 1                                                                  \r\n          - 2                                                                  \r\n          - 3                                                                  \r\n        - bar:                                                                  \r\n          - a                                                                  \r\n          - b                                                                  \r\n          - c\r\n```\r\ntest2.yml\r\n````\r\n- set_fact:                                                                    \r\n    outer_item: \"{{ item }}\"     \r\n````\r\n\r\ntest3.yml\r\n````\r\n- set_fact:\r\n  the_key: \"{{ item.key }}\"\r\n \r\n- debug: msg=\"The key is {{ the_key }}\"\r\n````\r\n\r\n##### Expected Results:\r\n\r\ntest3.yml should set the_key to the key of the hash passed as input\r\n\r\n##### Actual Results:\r\n\r\n\r\n\r\n```\r\nPLAY [Looping with includes test] **********************************************\r\n \r\nTASK [include] *****************************************************************\r\nincluded: /home/akosmin/sailthru/github/ansible/roles/aws-ec2/tests/test2.yml for localhost\r\nincluded: /home/akosmin/sailthru/github/ansible/roles/aws-ec2/tests/test2.yml for localhost\r\n \r\nTASK [set_fact] ****************************************************************\r\nok: [localhost]\r\n \r\nTASK [include] *****************************************************************\r\nincluded: /home/akosmin/sailthru/github/ansible/roles/aws-ec2/tests/test3.yml for localhost\r\n \r\nTASK [set_fact] ****************************************************************\r\nfatal: [localhost]: FAILED! => {\"failed\": true, \"msg\": \"'dict object' has no attribute 'key'\"}\r\n        to retry, use: --limit @roles/aws-ec2/tests/test1.retry\r\n \r\nPLAY RECAP *********************************************************************\r\nlocalhost                  : ok=4    changed=0    unreachable=0    failed=1\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/193929998","html_url":"https://github.com/ansible/ansible/issues/14850#issuecomment-193929998","issue_url":"https://api.github.com/repos/ansible/ansible/issues/14850","id":193929998,"user":{"login":"tveon","id":1783321,"avatar_url":"https://avatars.githubusercontent.com/u/1783321?v=3","gravatar_id":"","url":"https://api.github.com/users/tveon","html_url":"https://github.com/tveon","followers_url":"https://api.github.com/users/tveon/followers","following_url":"https://api.github.com/users/tveon/following{/other_user}","gists_url":"https://api.github.com/users/tveon/gists{/gist_id}","starred_url":"https://api.github.com/users/tveon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tveon/subscriptions","organizations_url":"https://api.github.com/users/tveon/orgs","repos_url":"https://api.github.com/users/tveon/repos","events_url":"https://api.github.com/users/tveon/events{/privacy}","received_events_url":"https://api.github.com/users/tveon/received_events","type":"User","site_admin":false},"created_at":"2016-03-08T19:22:58Z","updated_at":"2016-03-08T19:22:58Z","body":"It is not clear to me, what you are trying to achieve. Why would the item in test3.yml have a key property?\r\n\r\nFrom what I see, your items (which is a list), contains two dicts, one with a key named \"foo\" pointing to a list with three integers, and one with a key named \"bar\" pointing to an identical list.\r\n\r\nIf what you are trying to do, is to use the built-in method key**s**, then you are still out of luck: https://github.com/ansible/ansible/issues/10581\r\n"}}