# Declare variable for included playbook

**URL:** <https://forum.ansible.com/t/declare-variable-for-included-playbook/13415>\
**Category:** Ansible Project\
**Created:** [September 4, 2013, 2:07pm UTC](https://forum.ansible.com/t/declare-variable-for-included-playbook/13415 "2013-09-04T14:07:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Konstantin\_Root](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@Konstantin\_Root](https://forum.ansible.com/u/Konstantin_Root)\
**Post date:** [September 4, 2013, 2:07pm UTC](https://forum.ansible.com/t/declare-variable-for-included-playbook/13415/1 "2013-09-04T14:07:22Z")

</div>

Hi,

I’m including 1 playbook into another and having problem with passing variables to it - declaring variable in “include” doesn’t work.

What i’m trying to do:  
main file:

- include: prepare-server.yml target\_hosts=VALUE

prepare-server.yml playbook:

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [September 4, 2013, 3:04pm UTC](https://forum.ansible.com/t/declare-variable-for-included-playbook/13415/2 "2013-09-04T15:04:27Z")

</div>

I don’t believe you can parameterize playbook includes.

Perhaps you can just use “-e” on the command line to specify?

---

<div class="post-metadata">

**Author:** ![Konstantin\_Root](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@Konstantin\_Root](https://forum.ansible.com/u/Konstantin_Root)\
**Post date:** [September 4, 2013, 5:05pm UTC](https://forum.ansible.com/t/declare-variable-for-included-playbook/13415/3 "2013-09-04T17:05:43Z")

</div>

It will be not so usefull - basically i want to use the same hosts parameter value in included playbook as in top level playbook.
