##### SUMMARY
Loading template files in a loop leads to RepresenterErrors using YAML callback

Note that in the real world, this can manifest itself in the task erroring out, although I can't reproduce that in a more minimal test case as yet - I hope that the below information is enough to eliminate the underlying issue.

Other notes: 
* If I remove the trailing `-`, the task succeeds. But I added the trailing dash to counter #49579
* This works fine if I use the default stdout callback
* If there is only one element in the loop, we don't see the problem(!)

##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME
lib/ansible/plugins/callback/yaml.py

##### ANSIBLE VERSION
<!--- Paste verbatim output from "ansible --version" between quotes -->
```paste below
ansible-playbook 2.9.0b1
  config file = /Users/will/tmp/ansible/2.9.0b1/ansible.cfg
  configured module search path = [u'/Users/will/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/will/src/opensource/ansible/lib/ansible
  executable location = /Users/will/src/opensource/ansible/bin/ansible-playbook
  python version = 2.7.16 (default, Sep  2 2019, 11:59:44) [GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.4)]
```

##### CONFIGURATION
<!--- Paste verbatim output from "ansible-config dump --only-changed" between quotes -->
```paste below
DEFAULT_STDOUT_CALLBACK(/Users/will/tmp/ansible/2.9.0b1/ansible.cfg) = yaml
```

##### OS / ENVIRONMENT
N/A


##### STEPS TO REPRODUCE
<!--- Describe exactly how to reproduce the problem, using a minimal test-case -->

<!--- Paste example playbooks or commands between quotes below -->
```yaml
- hosts: localhost
  vars:
    kube_resource_manifests_from_files: []
    kube_resource_manifest_files:
      - a.yml
      - b.yml

  tasks:

  - name: create manifests list
    set_fact:
      kube_resource_manifests_from_files: >-
        {{ kube_resource_manifests_from_files + lookup('template', item)| from_yaml_all | list }}
    loop: "{{ kube_resource_manifest_files }}"
```

echo "hello: world" > a.yml
echo "hello: world" > b.yml

<!--- HINT: You can paste gist.github.com links for larger files -->

##### EXPECTED RESULTS
<!--- Describe what you expected to happen when running the steps above -->

As per 2.8.5

```
$ ansible-playbook play.yml -vvv -e app=xyz
ansible-playbook 2.8.5
  config file = /Users/will/tmp/ansible/2.9.0b1/ansible.cfg
  configured module search path = [u'/Users/will/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/will/src/opensource/ansible/lib/ansible
  executable location = /Users/will/src/opensource/ansible/bin/ansible-playbook
  python version = 2.7.16 (default, Sep  2 2019, 11:59:44) [GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.4)]
Using /Users/will/tmp/ansible/2.9.0b1/ansible.cfg as config file
host_list declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
script declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
yaml declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
ini declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
toml declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
 [WARNING]: No inventory was parsed, only implicit localhost is available

 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'


PLAYBOOK: play.yml ****************************************************************************************************************************************************************************************************************************
1 plays in play.yml

PLAY [localhost] ******************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ************************************************************************************************************************************************************************************************************************
task path: /Users/will/tmp/ansible/2.9.0b1/play.yml:1
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: will
<127.0.0.1> EXEC /bin/sh -c 'echo ~will && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/will/.ansible/tmp/ansible-tmp-1568854487.54-231484033082638 `" && echo ansible-tmp-1568854487.54-231484033082638="` echo /Users/will/.ansible/tmp/ansible-tmp-1568854487.54-231484033082638 `" ) && sleep 0'
Using module file /Users/will/src/opensource/ansible/lib/ansible/modules/system/setup.py
<127.0.0.1> PUT /Users/will/.ansible/tmp/ansible-local-66982kKOKoR/tmpZAoBok TO /Users/will/.ansible/tmp/ansible-tmp-1568854487.54-231484033082638/AnsiballZ_setup.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /Users/will/.ansible/tmp/ansible-tmp-1568854487.54-231484033082638/ /Users/will/.ansible/tmp/ansible-tmp-1568854487.54-231484033082638/AnsiballZ_setup.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/local/opt/python@2/bin/python2.7 /Users/will/.ansible/tmp/ansible-tmp-1568854487.54-231484033082638/AnsiballZ_setup.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /Users/will/.ansible/tmp/ansible-tmp-1568854487.54-231484033082638/ > /dev/null 2>&1 && sleep 0'
ok: [localhost]
META: ran handlers

TASK [create manifests list] ******************************************************************************************************************************************************************************************************************
task path: /Users/will/tmp/ansible/2.9.0b1/play.yml:10
ok: [localhost] => (item=a.yml) => changed=false 
  ansible_facts:
    kube_resource_manifests_from_files:
    - hello: world
  ansible_loop_var: item
  item: a.yml
ok: [localhost] => (item=b.yml) => changed=false 
  ansible_facts:
    kube_resource_manifests_from_files:
    - hello: world
    - hello: world
  ansible_loop_var: item
  item: b.yml
META: ran handlers
META: ran handlers

PLAY RECAP ************************************************************************************************************************************************************************************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

```

##### ACTUAL RESULTS
<!--- Describe what actually happened. If possible run with extra verbosity (-vvvv) -->

<!--- Paste verbatim command output between quotes -->
```paste below
$ ansible-playbook play.yml -vvv -e app=xyz
ansible-playbook 2.9.0b1
  config file = /Users/will/tmp/ansible/2.9.0b1/ansible.cfg
  configured module search path = [u'/Users/will/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/will/src/opensource/ansible/lib/ansible
  executable location = /Users/will/src/opensource/ansible/bin/ansible-playbook
  python version = 2.7.16 (default, Sep  2 2019, 11:59:44) [GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.4)]
Using /Users/will/tmp/ansible/2.9.0b1/ansible.cfg as config file
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
yaml declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
ini declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
toml declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
 [WARNING]: No inventory was parsed, only implicit localhost is available

 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'


PLAYBOOK: play.yml ****************************************************************************************************************************************************************************************************************************
1 plays in play.yml

PLAY [localhost] ******************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ************************************************************************************************************************************************************************************************************************
task path: /Users/will/tmp/ansible/2.9.0b1/play.yml:1
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: will
<127.0.0.1> EXEC /bin/sh -c 'echo ~will && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/will/.ansible/tmp/ansible-tmp-1568854348.48-81455736502302 `" && echo ansible-tmp-1568854348.48-81455736502302="` echo /Users/will/.ansible/tmp/ansible-tmp-1568854348.48-81455736502302 `" ) && sleep 0'
Using module file /Users/will/src/opensource/ansible/lib/ansible/modules/system/setup.py
<127.0.0.1> PUT /Users/will/.ansible/tmp/ansible-local-66662BWCIQr/tmp6yajej TO /Users/will/.ansible/tmp/ansible-tmp-1568854348.48-81455736502302/AnsiballZ_setup.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /Users/will/.ansible/tmp/ansible-tmp-1568854348.48-81455736502302/ /Users/will/.ansible/tmp/ansible-tmp-1568854348.48-81455736502302/AnsiballZ_setup.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/local/opt/python@2/bin/python2.7 /Users/will/.ansible/tmp/ansible-tmp-1568854348.48-81455736502302/AnsiballZ_setup.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /Users/will/.ansible/tmp/ansible-tmp-1568854348.48-81455736502302/ > /dev/null 2>&1 && sleep 0'
ok: [localhost]
META: ran handlers

TASK [create manifests list] ******************************************************************************************************************************************************************************************************************
task path: /Users/will/tmp/ansible/2.9.0b1/play.yml:10
 [WARNING]: Failure using method (v2_runner_item_on_ok) in callback plugin (<ansible.plugins.callback.yaml.CallbackModule object at 0x106873210>): cannot represent an object: world

Callback Exception: 
  File "/Users/will/src/opensource/ansible/lib/ansible/executor/task_queue_manager.py", line 323, in send_callback
    method(*new_args, **kwargs)
   File "/Users/will/src/opensource/ansible/lib/ansible/plugins/callback/default.py", line 320, in v2_runner_item_on_ok
    msg += " => %s" % self._dump_results(result._result)
   File "/Users/will/src/opensource/ansible/lib/ansible/plugins/callback/yaml.py", line 123, in _dump_results
    dumped += to_text(yaml.dump(abridged_result, allow_unicode=True, width=1000, Dumper=AnsibleDumper, default_flow_style=False))
   File "/usr/local/lib/python2.7/site-packages/yaml/__init__.py", line 202, in dump
    return dump_all([data], stream, Dumper=Dumper, **kwds)
   File "/usr/local/lib/python2.7/site-packages/yaml/__init__.py", line 190, in dump_all
    dumper.represent(data)
   File "/usr/local/lib/python2.7/site-packages/yaml/representer.py", line 28, in represent
    node = self.represent_data(data)
   File "/usr/local/lib/python2.7/site-packages/yaml/representer.py", line 57, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
   File "/usr/local/lib/python2.7/site-packages/yaml/representer.py", line 225, in represent_dict
    return self.represent_mapping(u'tag:yaml.org,2002:map', data)
   File "/usr/local/lib/python2.7/site-packages/yaml/representer.py", line 123, in represent_mapping
    node_value = self.represent_data(item_value)
   File "/usr/local/lib/python2.7/site-packages/yaml/representer.py", line 57, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
   File "/usr/local/lib/python2.7/site-packages/yaml/representer.py", line 225, in represent_dict
    return self.represent_mapping(u'tag:yaml.org,2002:map', data)
   File "/usr/local/lib/python2.7/site-packages/yaml/representer.py", line 123, in represent_mapping
    node_value = self.represent_data(item_value)
   File "/usr/local/lib/python2.7/site-packages/yaml/representer.py", line 57, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
   File "/usr/local/lib/python2.7/site-packages/yaml/representer.py", line 217, in represent_list
    return self.represent_sequence(u'tag:yaml.org,2002:seq', data)
   File "/usr/local/lib/python2.7/site-packages/yaml/representer.py", line 101, in represent_sequence
    node_item = self.represent_data(item)
   File "/usr/local/lib/python2.7/site-packages/yaml/representer.py", line 57, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
   File "/usr/local/lib/python2.7/site-packages/yaml/representer.py", line 225, in represent_dict
    return self.represent_mapping(u'tag:yaml.org,2002:map', data)
   File "/usr/local/lib/python2.7/site-packages/yaml/representer.py", line 123, in represent_mapping
    node_value = self.represent_data(item_value)
   File "/usr/local/lib/python2.7/site-packages/yaml/representer.py", line 67, in represent_data
    node = self.yaml_representers[None](self, data)
   File "/usr/local/lib/python2.7/site-packages/yaml/representer.py", line 249, in represent_undefined
    raise RepresenterError("cannot represent an object: %s" % data)

ok: [localhost] => (item=b.yml) => changed=false 
  ansible_facts:
    kube_resource_manifests_from_files:
    - hello: world
    - hello: world
  ansible_loop_var: item
  item: b.yml
META: ran handlers
META: ran handlers

PLAY RECAP ************************************************************************************************************************************************************************************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
```

#
#
#
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import io
from units.compat import unittest
from ansible.parsing import vault
from ansible.parsing.yaml import dumper, objects
from ansible.parsing.yaml.loader import AnsibleLoader
from units.mock.yaml_helper import YamlTestUtils
from units.mock.vault_helper import TextVaultSecret
class TestAnsibleDumper(unittest.TestCase, YamlTestUtils):