title: ERROR! Unexpected Exception, this is probably a bug: unhashable type: 'AnsibleMapping'
body: <p>I have been trying to get my first trial with templating with Ansible to work and I am stopped by this following exception. As far as I can see, I think I have maintained the indentation well and also validated the yml file. I don't know where to go from here, help pls! Below is the yml file followed by the exception I saw after ran the playbook.</p>
  
  <pre><code>
  ---
  
  - name: run these tasks on the host
    hosts:
      testhost:
      testhost1: "172.16.201.163"
    vars:
      ansible_port: 22
    tasks:
  
      - name: Templating
        template:
          dest: /etc/my_test.conf
          owner: root
          src: my_test.j2
        become: true
  </code></pre>
  
  <p>The output from the run</p>
  
  <pre><code>ERROR! Unexpected Exception, this is probably a bug: unhashable type: 'AnsibleMapping'
  the full traceback was:
  
  Traceback (most recent call last):
    File "/usr/local/bin/ansible-playbook", line 118, in &lt;module&gt;
      exit_code = cli.run()
    File "/usr/local/Cellar/ansible/2.7.9/libexec/lib/python3.7/site-packages/ansible/cli/playbook.py", line 122, in run
      results = pbex.run()
    File "/usr/local/Cellar/ansible/2.7.9/libexec/lib/python3.7/site-packages/ansible/executor/playbook_executor.py", line 106, in run
      all_vars = self._variable_manager.get_vars(play=play)
    File "/usr/local/Cellar/ansible/2.7.9/libexec/lib/python3.7/site-packages/ansible/vars/manager.py", line 185, in get_vars
      include_delegate_to=include_delegate_to,
    File "/usr/local/Cellar/ansible/2.7.9/libexec/lib/python3.7/site-packages/ansible/vars/manager.py", line 470, in _get_magic_variables
      variables['ansible_play_hosts_all'] = [x.name for x in self._inventory.get_hosts(pattern=pattern, ignore_restrictions=True)]
    File "/usr/local/Cellar/ansible/2.7.9/libexec/lib/python3.7/site-packages/ansible/inventory/manager.py", line 358, in get_hosts
      if pattern_hash not in self._hosts_patterns_cache:
  TypeError: unhashable type: 'AnsibleMapping'
  
  </code></pre>