{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/12301","labels_url":"https://api.github.com/repos/ansible/ansible/issues/12301/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/12301/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/12301/events","html_url":"https://github.com/ansible/ansible/issues/12301","id":105684788,"number":12301,"title":"set_fact blows away registered variables","user":{"login":"neocortical","id":250256,"avatar_url":"https://avatars.githubusercontent.com/u/250256?v=3","gravatar_id":"","url":"https://api.github.com/users/neocortical","html_url":"https://github.com/neocortical","followers_url":"https://api.github.com/users/neocortical/followers","following_url":"https://api.github.com/users/neocortical/following{/other_user}","gists_url":"https://api.github.com/users/neocortical/gists{/gist_id}","starred_url":"https://api.github.com/users/neocortical/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neocortical/subscriptions","organizations_url":"https://api.github.com/users/neocortical/orgs","repos_url":"https://api.github.com/users/neocortical/repos","events_url":"https://api.github.com/users/neocortical/events{/privacy}","received_events_url":"https://api.github.com/users/neocortical/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible/labels/bug_report","name":"bug_report","color":"fbca04"},{"url":"https://api.github.com/repos/ansible/ansible/labels/P1","name":"P1","color":"f7c6c7"}],"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/v2","labels_url":"https://api.github.com/repos/ansible/ansible/milestones/5/labels","id":975800,"number":5,"title":"v2","description":null,"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":21,"closed_issues":263,"state":"open","created_at":"2015-02-11T19:43:06Z","updated_at":"2015-09-09T22:54:36Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-09-09T21:07:56Z","updated_at":"2015-09-09T23:07:46Z","closed_at":"2015-09-09T22:29:31Z","body":"Issue Type: bug report (or I am completely misunderstanding something)\r\n\r\nAnsible version: 2 (devel branch)\r\n\r\nThis issue appears to have introduced by this commit: https://github.com/ansible/ansible/commit/56d7f3889d5550ab6dc105bdb48471d29f71446e\r\n\r\nDescription: When calling `set_fact` and creating a new variable with a value from a registered variable, the registered variable's value is replaced with \"VARIABLE IS NOT DEFINED!\". \r\n\r\nThe following playbook reproduces the issue: \r\n```yaml\r\n---\r\n\r\n- \r\n  hosts: localhost\r\n  connection: local\r\n  gather_facts: False\r\n  vars: \r\n    bar: baz\r\n  tasks:\r\n\r\n    - name: register a var\r\n      debug: var=bar\r\n      register: foo\r\n\r\n    - name: inspect foo var\r\n      debug: var=foo\r\n\r\n    - name: Set a fact\r\n      set_fact: qux=\"{{ foo.bar }}\"\r\n\r\n    - name: inspect qux\r\n      debug: var=qux\r\n\r\n    - name: foo var no longer exists\r\n      debug: var=foo\r\n```\r\n\r\nExpected behavior: Prior to commit 56d7f38, the output is as expected: \r\n```\r\nPLAY ***************************************************************************\r\n\r\nTASK [register a var] **********************************************************\r\nok: [localhost] => {\r\n    \"bar\": \"baz\", \r\n    \"changed\": false\r\n}\r\n\r\nTASK [inspect foo var] *********************************************************\r\nok: [localhost] => {\r\n    \"changed\": false, \r\n    \"foo\": {\r\n        \"_ansible_verbose_always\": true, \r\n        \"bar\": \"baz\", \r\n        \"changed\": false\r\n    }\r\n}\r\n\r\nTASK [Set a fact] **************************************************************\r\nok: [localhost]\r\n\r\nTASK [inspect qux] *************************************************************\r\nok: [localhost] => {\r\n    \"changed\": false, \r\n    \"qux\": \"baz\"\r\n}\r\n\r\nTASK [foo var no longer exists] ************************************************\r\nok: [localhost] => {\r\n    \"changed\": false, \r\n    \"foo\": {\r\n        \"_ansible_verbose_always\": true, \r\n        \"bar\": \"baz\", \r\n        \"changed\": false\r\n    }\r\n}\r\n\r\nPLAY RECAP *********************************************************************\r\nlocalhost                  : ok=5    changed=0    unreachable=0    failed=0  \r\n```\r\n\r\nObserved behavior: From 56d7f38 on, the output is: \r\n```\r\nPLAY ***************************************************************************\r\n\r\nTASK [register a var] **********************************************************\r\nok: [localhost] => {\r\n    \"bar\": \"baz\", \r\n    \"changed\": false\r\n}\r\n\r\nTASK [inspect foo var] *********************************************************\r\nok: [localhost] => {\r\n    \"changed\": false, \r\n    \"foo\": {\r\n        \"_ansible_verbose_always\": true, \r\n        \"bar\": \"baz\", \r\n        \"changed\": false\r\n    }\r\n}\r\n\r\nTASK [Set a fact] **************************************************************\r\nok: [localhost]\r\n\r\nTASK [inspect qux] *************************************************************\r\nok: [localhost] => {\r\n    \"changed\": false, \r\n    \"qux\": \"baz\"\r\n}\r\n\r\nTASK [foo var no longer exists] ************************************************\r\nok: [localhost] => {\r\n    \"changed\": false, \r\n    \"foo\": \"VARIABLE IS NOT DEFINED!\"\r\n}\r\n\r\nPLAY RECAP *********************************************************************\r\nlocalhost                  : ok=5    changed=0    unreachable=0    failed=0  \r\n```\r\n\r\nEnvironment: Mac OS X Yosemite, Python 2.7.10"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/139068564","html_url":"https://github.com/ansible/ansible/issues/12301#issuecomment-139068564","issue_url":"https://api.github.com/repos/ansible/ansible/issues/12301","id":139068564,"user":{"login":"neocortical","id":250256,"avatar_url":"https://avatars.githubusercontent.com/u/250256?v=3","gravatar_id":"","url":"https://api.github.com/users/neocortical","html_url":"https://github.com/neocortical","followers_url":"https://api.github.com/users/neocortical/followers","following_url":"https://api.github.com/users/neocortical/following{/other_user}","gists_url":"https://api.github.com/users/neocortical/gists{/gist_id}","starred_url":"https://api.github.com/users/neocortical/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neocortical/subscriptions","organizations_url":"https://api.github.com/users/neocortical/orgs","repos_url":"https://api.github.com/users/neocortical/repos","events_url":"https://api.github.com/users/neocortical/events{/privacy}","received_events_url":"https://api.github.com/users/neocortical/received_events","type":"User","site_admin":false},"created_at":"2015-09-09T23:07:46Z","updated_at":"2015-09-09T23:07:46Z","body":"Thanks for the fast turnaround! Verified that devel/HEAD is now working as expected for me.\r\n\r\nTo be clear, I wasn't trying to overwrite a registered variable, only read it into another variable using set_fact. But problem solved in any case.\r\n"}}