# exception: mapping values are not allowed in this context

**URL:** <https://forum.ansible.com/t/exception-mapping-values-are-not-allowed-in-this-context/27067>\
**Category:** Ansible Project\
**Created:** [March 21, 2018, 3:53pm UTC](https://forum.ansible.com/t/exception-mapping-values-are-not-allowed-in-this-context/27067 "2018-03-21T15:53:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Harmon](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Harmon](https://forum.ansible.com/u/John_Harmon)\
**Post date:** [March 21, 2018, 3:53pm UTC](https://forum.ansible.com/t/exception-mapping-values-are-not-allowed-in-this-context/27067/1 "2018-03-21T15:53:34Z")

</div>

I have the following playbook. If I comment out the line for import\_playbook, the error goes away. Can anybody see what is wrong with this? I am guessing a syntax error, but I can’t seem to find it. Thanks in advance!:

`

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [March 21, 2018, 4:00pm UTC](https://forum.ansible.com/t/exception-mapping-values-are-not-allowed-in-this-context/27067/2 "2018-03-21T16:00:19Z")

</div>

`import_playbook` cannot be used within a play. Your play starts with `- hosts: "{{ host }}"`. Your `import_playbook` would need to come either before that, or after your `fail` task.

Maybe you are looking for `import_tasks` instead?

---

<div class="post-metadata">

**Author:** ![John\_Harmon](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Harmon](https://forum.ansible.com/u/John_Harmon)\
**Post date:** [March 21, 2018, 4:03pm UTC](https://forum.ansible.com/t/exception-mapping-values-are-not-allowed-in-this-context/27067/3 "2018-03-21T16:03:59Z")

</div>

Matt, thank you. I wasn’t aware of import\_tasks, but it does what I want it to do. Thanks again!
