{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/12176","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/12176/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/12176/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/12176/events","html_url":"https://github.com/ansible/ansible/issues/12176","id":104184907,"number":12176,"title":"with_subelements example from documentation doesn't work","user":{"login":"emanation","id":2053069,"avatar_url":"https://avatars.githubusercontent.com/u/2053069?v=3","gravatar_id":"","url":"https://api.github.com/users/emanation","html_url":"https://github.com/emanation","followers_url":"https://api.github.com/users/emanation/followers","following_url":"https://api.github.com/users/emanation/following{/other_user}","gists_url":"https://api.github.com/users/emanation/gists{/gist_id}","starred_url":"https://api.github.com/users/emanation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emanation/subscriptions","organizations_url":"https://api.github.com/users/emanation/orgs","repos_url":"https://api.github.com/users/emanation/repos","events_url":"https://api.github.com/users/emanation/events{/privacy}","received_events_url":"https://api.github.com/users/emanation/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":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/ansible/ansible/milestones/7","html_url":"https://github.com/ansible/ansible/milestones/stable-1.9","labels_url":"https://api.github.com/repos/ansible/ansible/milestones/7/labels","id":1326964,"number":7,"title":"stable-1.9","description":"","creator":{"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},"open_issues":38,"closed_issues":51,"state":"open","created_at":"2015-09-28T14:27:40Z","updated_at":"2016-08-01T21:45:17Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2015-09-01T04:34:59Z","updated_at":"2016-08-09T12:33:00Z","closed_at":null,"body":"Hello\r\nI really get lost. I spent 2 days with playbook trying to use `with_subelements` feature. After all I tried to run example from [Documentation](http://docs.ansible.com/ansible/playbooks_loops.html#looping-over-subelements)\r\n```\r\ntasks:\r\n  - name: Print webcred_result\r\n    debug: var=users\r\n    tags: debugvars\r\n\r\n  - name: Setup MySQL users\r\n    debug: var=\"user={{ item.0.user }}\"\r\n    with_subelements:\r\n    - users\r\n    - mysql.hosts\r\n    tags: debugvars\r\n```\r\nI use `debug` module here. but playbook fails on sub loop.\r\nAnd issue happens only if second list uses nested subkey like `mysql.hosts`\r\n\r\n```\r\nTASK: [Print users var] ************************************************** \r\nok: [testinghost] => {\r\n    \"var\": {\r\n        \"users\": [\r\n            {\r\n                \"authorized\": [\r\n                    \"/tmp/alice/onekey.pub\",\r\n                    \"/tmp/alice/twokey.pub\"\r\n                ],\r\n                \"mysql\": {\r\n                    \"hosts\": [\r\n                        \"%\",\r\n                        \"127.0.0.1\",\r\n                        \"::1\",\r\n                        \"localhost\"\r\n                    ],\r\n                    \"password\": \"mysql-password\",\r\n                    \"privs\": [\r\n                        \"*.*:SELECT\",\r\n                        \"DB1.*:ALL\"\r\n                    ]\r\n                },\r\n                \"name\": \"alice\"\r\n            },\r\n            {\r\n                \"authorized\": [\r\n                    \"/tmp/bob/id_rsa.pub\"\r\n                ],\r\n                \"mysql\": {\r\n                    \"hosts\": [\r\n                        \"db1\"\r\n                    ],\r\n                    \"password\": \"other-mysql-password\",\r\n                    \"privs\": [\r\n                        \"*.*:SELECT\",\r\n                        \"DB2.*:ALL\"\r\n                    ]\r\n                },\r\n                \"name\": \"bob\"\r\n            }\r\n        ]\r\n    }\r\n}\r\n\r\nTASK: [Setup MySQL users] ***************************************************** \r\nfatal: [testinghost] => could not find 'mysql.hosts' key in iterated item '{'authorized': ['/tmp/alice/onekey.pub', '/tmp/alice/twokey.pub'], 'name': 'alice', 'mysql': {'password': 'mysql-password', 'hosts': ['%', '127.0.0.1', '::1', 'localhost'], 'privs': ['*.*:SELECT', 'DB1.*:ALL']}}'\r\n\r\nFATAL: all hosts have already failed -- aborting\r\n```\r\n\r\nAnd you can see at `debug: var=users` and fatal error report that `mysql.hosts` does exist indeed.\r\nI was thinking that it's issue with key declaration but `\"{{mysql.hosts}}\"` , `mysql[hosts]` or \"{{mysql[hosts]}}\" do not help.\r\nSorry if I missed something but I really was too close to commit my mental disorder while was debugging this. \r\nAnsible is 1.9.2  with Python 2.7.6\r\nThanks."},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/238538618","html_url":"https://github.com/ansible/ansible/issues/12176#issuecomment-238538618","issue_url":"https://api.github.com/repos/ansible/ansible/issues/12176","id":238538618,"user":{"login":"julienvey","id":455944,"avatar_url":"https://avatars.githubusercontent.com/u/455944?v=3","gravatar_id":"","url":"https://api.github.com/users/julienvey","html_url":"https://github.com/julienvey","followers_url":"https://api.github.com/users/julienvey/followers","following_url":"https://api.github.com/users/julienvey/following{/other_user}","gists_url":"https://api.github.com/users/julienvey/gists{/gist_id}","starred_url":"https://api.github.com/users/julienvey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/julienvey/subscriptions","organizations_url":"https://api.github.com/users/julienvey/orgs","repos_url":"https://api.github.com/users/julienvey/repos","events_url":"https://api.github.com/users/julienvey/events{/privacy}","received_events_url":"https://api.github.com/users/julienvey/received_events","type":"User","site_admin":false},"created_at":"2016-08-09T12:33:00Z","updated_at":"2016-08-09T12:33:00Z","body":"Using a simple playbook, this feature works with ansible 2.0+ but doesn't with ansible 1.9"}}
{"actor":{"display_login":"julienvey"}}