{"action":"opened","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/15426","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/15426/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/15426/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/15426/events","html_url":"https://github.com/ansible/ansible/issues/15426","id":148548434,"number":15426,"title":"Getting \"Syntax Error while loading YAML\" when performing regex_replace","user":{"login":"vrodrigues","id":832270,"avatar_url":"https://avatars.githubusercontent.com/u/832270?v=3","gravatar_id":"","url":"https://api.github.com/users/vrodrigues","html_url":"https://github.com/vrodrigues","followers_url":"https://api.github.com/users/vrodrigues/followers","following_url":"https://api.github.com/users/vrodrigues/following{/other_user}","gists_url":"https://api.github.com/users/vrodrigues/gists{/gist_id}","starred_url":"https://api.github.com/users/vrodrigues/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vrodrigues/subscriptions","organizations_url":"https://api.github.com/users/vrodrigues/orgs","repos_url":"https://api.github.com/users/vrodrigues/repos","events_url":"https://api.github.com/users/vrodrigues/events{/privacy}","received_events_url":"https://api.github.com/users/vrodrigues/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-15T03:56:54Z","updated_at":"2016-04-15T03:56:54Z","closed_at":null,"body":"##### ISSUE TYPE\r\n - Bug Report\r\n\r\n##### ANSIBLE VERSION\r\n```\r\nansible 2.0.1.0\r\n  config file = /Users/vrodrigues/Code/ansible.cfg\r\n  configured module search path = ./ansible/library\r\n```\r\n\r\n##### CONFIGURATION\r\n<!---\r\n-->\r\n\r\n##### OS / ENVIRONMENT\r\n<!---\r\nN/A\r\n-->\r\n\r\n##### SUMMARY\r\n<!\r\nI'm doing the following\r\n- name: git pull from apps repo\r\n  command: git pull --depth=1\r\n  args:\r\n    chdir: \"{{ apps_path }}/{{ item }}\"\r\n  with_items:\r\n    \"{{ apps }}\"\r\n  register: pull_result\r\n\r\n- debug: msg={{ item.stdout | regex_replace('^(.*)\"stdout\": (.*).$', '\\\\1 \\\\2') }}\r\n  with_items:\r\n    \"{{ pull_result.results }}\"\r\n\r\nI get a \"Syntax Error while loading YAML\" error.\r\n-->\r\n\r\n##### STEPS TO REPRODUCE\r\n<!---\r\nRun above Ansible command.\r\n-->\r\n\r\n```\r\n<!\r\n- debug: msg={{ item.stdout | regex_replace('^(.*)\"stdout\": (.*).$', '\\\\1 \\\\2') }}\r\n  with_items:\r\n    \"{{ pull_result.results }}\"\r\n-->\r\n```\r\n\r\n##### EXPECTED RESULTS\r\n<!--- \r\nExpect the script to execute successfully.\r\n-->\r\n\r\n##### ACTUAL RESULTS\r\n<!--- \r\nfatal: [10.80.80.150]: FAILED! => {\"failed\": true, \"reason\": \"Syntax Error while loading YAML.\\n\\n\\nThe error appears to have been in '/Users/vrodrigues/Code/cochlear/deploy/ansible/roles/applications/splunk_server_update/tasks/update_apps.yml': line 51, column 59, but may\\nbe elsewhere in the file depending on the exact syntax problem.\\n\\nThe offending line appears to be:\\n\\n\\n- debug: msg={{ item.stdout | regex_replace('^(.*)\\\"stdout\\\": (.*).$', '\\\\\\\\1 \\\\\\\\2') }}\\n                                                          ^ here\\nWe could be wrong, but this one looks like it might be an issue with\\nmissing quotes.  Always quote template expression brackets when they\\nstart a value. For instance:\\n\\n    with_items:\\n      - {{ foo }}\\n\\nShould be written as:\\n\\n    with_items:\\n      - \\\"{{ foo }}\\\"\\n\"}\r\n-->\r\n\r\n```\r\n<!--- \r\nAs above\r\n-->\r\n```\r\n"}}