{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/23779","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/23779/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/23779/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/23779/events","html_url":"https://github.com/ansible/ansible/issues/23779","id":222934603,"number":23779,"title":"Jinja2 templates unable to import more than one file in Ansible 2.3.0.","user":{"login":"danielgriggs","id":16110195,"avatar_url":"https://avatars2.githubusercontent.com/u/16110195?v=3","gravatar_id":"","url":"https://api.github.com/users/danielgriggs","html_url":"https://github.com/danielgriggs","followers_url":"https://api.github.com/users/danielgriggs/followers","following_url":"https://api.github.com/users/danielgriggs/following{/other_user}","gists_url":"https://api.github.com/users/danielgriggs/gists{/gist_id}","starred_url":"https://api.github.com/users/danielgriggs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielgriggs/subscriptions","organizations_url":"https://api.github.com/users/danielgriggs/orgs","repos_url":"https://api.github.com/users/danielgriggs/repos","events_url":"https://api.github.com/users/danielgriggs/events{/privacy}","received_events_url":"https://api.github.com/users/danielgriggs/received_events","type":"User","site_admin":false},"labels":[{"id":454885231,"url":"https://api.github.com/repos/ansible/ansible/labels/affects_2.3","name":"affects_2.3","color":"5319e7","default":false},{"id":48276055,"url":"https://api.github.com/repos/ansible/ansible/labels/bug_report","name":"bug_report","color":"fbca04","default":false},{"id":496359346,"url":"https://api.github.com/repos/ansible/ansible/labels/module","name":"module","color":"1d76db","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-04-20T02:57:57Z","updated_at":"2017-04-23T12:11:13Z","closed_at":null,"body":"##### ISSUE TYPE\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\ntemplate module import statement\r\n\r\n##### ANSIBLE VERSION\r\n```\r\nansible 2.3.0.0\r\n  config file =\r\n  configured module search path = Default w/o overrides\r\n  python version = 2.7.13 (default, Dec 18 2016, 07:03:39) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]\r\n```\r\n\r\n##### CONFIGURATION\r\nNo additional configuration or modules.\r\n\r\n##### OS / ENVIRONMENT\r\nmacOS, Ansible installed from brew.\r\n\r\n##### SUMMARY\r\nIn Ansible 2.2.1 importing more than one file with macros worked fine for jinja2 templated files.\r\nAfter upgrading to Ansible 2.3.0 it no longer works at all and bombs out with an undecipherable error message.\r\n\r\n##### STEPS TO REPRODUCE\r\n```yaml\r\n---\r\n- hosts: localhost\r\n  vars:\r\n    var1: \"Works\"\r\n  tasks:\r\n    - name: Template a file\r\n      template:\r\n        src: \"template/{{ item }}.j2\"\r\n        dest: \"templated/{{ item }}.txt\"\r\n      with_items:\r\n        - file\r\n        - file-one-macro\r\n        - file-two-macro\r\n```\r\n\r\nAttached is a zip file with an broken example. Running the play book with error out on the third iteration of the task where the template file has more than one import statement.\r\n[testing-macros.zip](https://github.com/ansible/ansible/files/939599/testing-macros.zip)\r\n\r\n##### EXPECTED RESULTS\r\nExpected both files with macros to be imported and available.\r\n\r\n##### ACTUAL RESULTS\r\nThe only output from the task with errors is;\r\n```\r\nfailed: [localhost] (item=file-two-macro) => {\r\n    \"failed\": true,\r\n    \"item\": \"file-two-macro\",\r\n    \"msg\": \"KeyError: 'undefined variable: 0'\"\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/296439004","html_url":"https://github.com/ansible/ansible/issues/23779#issuecomment-296439004","issue_url":"https://api.github.com/repos/ansible/ansible/issues/23779","id":296439004,"user":{"login":"danielgriggs","id":16110195,"avatar_url":"https://avatars2.githubusercontent.com/u/16110195?v=3","gravatar_id":"","url":"https://api.github.com/users/danielgriggs","html_url":"https://github.com/danielgriggs","followers_url":"https://api.github.com/users/danielgriggs/followers","following_url":"https://api.github.com/users/danielgriggs/following{/other_user}","gists_url":"https://api.github.com/users/danielgriggs/gists{/gist_id}","starred_url":"https://api.github.com/users/danielgriggs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielgriggs/subscriptions","organizations_url":"https://api.github.com/users/danielgriggs/orgs","repos_url":"https://api.github.com/users/danielgriggs/repos","events_url":"https://api.github.com/users/danielgriggs/events{/privacy}","received_events_url":"https://api.github.com/users/danielgriggs/received_events","type":"User","site_admin":false},"created_at":"2017-04-23T12:11:13Z","updated_at":"2017-04-23T12:11:13Z","body":"No,\n\nI figured it was an integration issue, rather than a problem with Jinja.\n\n>\n> --\nSent from Mobile Command\n"}}
{"actor":{"display_login":"danielgriggs"}}