title: "ansible_failed_task" & "ansible_failed_result" variables are undefined when rescue block is in a file
body: <p>The <code>ansible_failed_task</code> and <code>ansible_failed_result</code> variables give undefined error, when error handling is done using block-rescue in a file which is called from <code>main.yml</code> inside an Ansible role.</p>
  
  <p>Folder structure:</p>
  
  <pre><code>roles/
    role-test/
      main.yml
      file_with_error_handling.yml
  </code></pre>
  
  <hr>
  
  <p><code>main.yml</code></p>
  
  <pre><code>- include file_with_error_handling.yml
  </code></pre>
  
  <hr>
  
  <p><code>file_with_error_handling.yml</code></p>
  
  <pre><code>- block:
      # some code with error.
    rescue:
      debug:
        msg: "Task- {{ ansible_failed_task }} failed with error {{ ansible_failed_result }}"
  </code></pre>
  
  <hr>
  
  <p><code>test.yml</code></p>
  
  <pre><code>- hosts: all
    become: yes 
    roles:
      - role-test
  </code></pre>
  
  <hr>
  
  <p>When <code>test.yml</code> is executed I get the below error:</p>
  
  <blockquote>
    <p>fatal: [localhost]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'ansible_failed_result' is undefined\n\nThe error appears to have been in '/tmp/test/role-test/tasks/test_main.yml': line 32, column 6, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n#      msg: \"ansible_failed_task- {{ ansible_failed_task }}\"\n   - debug:\n     ^ here\n"}</p>
  </blockquote>
  
  <p>And the same error I get for <code>ansible_failed_task</code> variable.</p>
  
  <p>If I copy the code of <code>file_with_error_handling.yml</code> in <code>main.yml</code> and then execute it, it works fine. I get the values in <code>ansible_failed_result</code> and <code>ansible_failed_task</code>. The problem occurs only when I call it from a file.</p>
  
  <p>Is there a way I can display the output of these variables?</p>