# set\_fact is not a valid attribute for a Play

**URL:** <https://forum.ansible.com/t/set-fact-is-not-a-valid-attribute-for-a-play/21197>\
**Category:** Ansible Project\
**Created:** [April 18, 2016, 4:09pm UTC](https://forum.ansible.com/t/set-fact-is-not-a-valid-attribute-for-a-play/21197 "2016-04-18T16:09:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![darknight](https://avatars.discourse-cdn.com/v4/letter/d/e79b87/32.png) [@darknight](https://forum.ansible.com/u/darknight)\
**Post date:** [April 18, 2016, 4:09pm UTC](https://forum.ansible.com/t/set-fact-is-not-a-valid-attribute-for-a-play/21197/1 "2016-04-18T16:09:16Z")

</div>

Hi Everyone,

I am a newbie using ansible and trying to write a playbook. I was encountering an issue with using set\_fact variable in my play and not sure where i am going wrong . could any one correct me on this error. Thanks for your time

_Error_:

**ERROR! ‘set\_fact’ is not a valid attribute for a Play**

**The offending line appears to be:**

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [April 19, 2016, 7:55am UTC](https://forum.ansible.com/t/set-fact-is-not-a-valid-attribute-for-a-play/21197/2 "2016-04-19T07:55:24Z")

</div>

Hi,

Can you share the whole of your playbook?

You probably need to specify some hosts that you want the playbook to apply to (something like this - not tested):

---

<div class="post-metadata">

**Author:** ![darknight](https://avatars.discourse-cdn.com/v4/letter/d/e79b87/32.png) [@darknight](https://forum.ansible.com/u/darknight)\
**Post date:** [April 19, 2016, 1:03pm UTC](https://forum.ansible.com/t/set-fact-is-not-a-valid-attribute-for-a-play/21197/3 "2016-04-19T13:03:50Z")

</div>

Hi J,

thanks for taking time to look into this.I was using kitchen-vagrant to do testing by launching debian in virtualbox. My hosts file,kitchen.yml, including main.yml and debian.yml files that i have so far in my play book are attached below. I am also curios if i can call tasks directly through the playbook or i need to mention their absolute path during the path. when i tried just the name of the task, it failed with the message “Error: not found”.

**Kitchen.yml**

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [April 19, 2016, 4:15pm UTC](https://forum.ansible.com/t/set-fact-is-not-a-valid-attribute-for-a-play/21197/4 "2016-04-19T16:15:16Z")

</div>

main.yml (after include) is not a playbook, its a task list, hence the message as it is trying to read the Task as a Play.
