# TypeError when using include

**URL:** <https://forum.ansible.com/t/typeerror-when-using-include/11455>\
**Category:** Ansible Project\
**Tags:** fedora\
**Created:** [April 26, 2012, 10:27am UTC](https://forum.ansible.com/t/typeerror-when-using-include/11455 "2012-04-26T10:27:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Duy\_Thang](https://avatars.discourse-cdn.com/v4/letter/d/a9a28c/32.png) [@Duy\_Thang](https://forum.ansible.com/u/Duy_Thang)\
**Post date:** [April 26, 2012, 10:27am UTC](https://forum.ansible.com/t/typeerror-when-using-include/11455/1 "2012-04-26T10:27:45Z")

</div>

Hi,

I’m newbie to ansible, and I have a problem when using include feature. I had a search in google and in mailinglist but cant find anything useful.  
This is my playbook.yml file:

> * * *
> 
> - hosts: mailservice  
> vars:  
> userdir: /data2/mailservice  
> user: root  
> tasks:
> - include: tasks/python-mail.yml
> - name: ensure mailservice directory exists  
> action: file path={{ userdir }} state=directory

And this is the content of file tasks/python-mail.yml:

> * * *
> 
> - name: install python  
> action: yum pkg=python state=installed

When I run the ansible-playbook command, it raise the error

> Traceback (most recent call last):  
> File “/usr/bin/ansible-playbook”, line 100, in   
> sys.exit(main(sys.argv[1:]))  
> File “/usr/bin/ansible-playbook”, line 77, in main  
> sudo\_pass=sudopass  
> File “/usr/lib/python2.7/site-packages/ansible/playbook.py”, line 104, in **init**  
> self.playbook = self.\_parse\_playbook(playbook)  
> File “/usr/lib/python2.7/site-packages/ansible/playbook.py”, line 192, in \_parse\_playbook  
> self.\_include\_tasks(play, task, dirname, new\_tasks)  
> File “/usr/lib/python2.7/site-packages/ansible/playbook.py”, line 157, in \_include\_tasks  
> included = utils.template\_from\_file(path, inject\_vars)  
> File “/usr/lib/python2.7/site-packages/ansible/utils.py”, line 255, in template\_from\_file  
> return template(data, vars)  
> TypeError: template() takes exactly 3 arguments (2 given)

It run ok if I comment out the include line. I’m using ansible version 0.3 on Fedora 16. Can you tell me what’s wrong with my config, or is it a bug? Thank you very much.

Regards,

---

<div class="post-metadata">

**Author:** ![Rodney\_Quillo](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@Rodney\_Quillo](https://forum.ansible.com/u/Rodney_Quillo)\
**Post date:** [April 26, 2012, 2:12pm UTC](https://forum.ansible.com/t/typeerror-when-using-include/11455/2 "2012-04-26T14:12:47Z")

</div>

Hi,

I think this is already fixed on the github ansible/devel branch.  
[https://github.com/ansible/ansible/pull/235](https://github.com/ansible/ansible/pull/235)

If you are cloning the git ansible git repo you can switch to the  
devel branch.

ex.  
&nbsp;&nbsp;$ git clone [https://github.com/ansible/ansible.git](https://github.com/ansible/ansible.git)  
&nbsp;&nbsp;$ cd ansible  
&nbsp;&nbsp;$ git checkout devel

Set your ansible hosts, and environment:  
&nbsp;&nbsp;$ export ANSIBLE\_HOSTS=/path/to-your/ansible-host  
&nbsp;&nbsp;$ source ./hacking/env\_setup

Now test and run your playbook. 🙂

Hope that helps.

--Cocoy

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [April 26, 2012, 2:20pm UTC](https://forum.ansible.com/t/typeerror-when-using-include/11455/3 "2012-04-26T14:20:18Z")

</div>

It’s been fixed on master too.

I thought I already posted this to the list, but you need to pull for updates.

---

<div class="post-metadata">

**Author:** ![Duy\_Thang](https://avatars.discourse-cdn.com/v4/letter/d/a9a28c/32.png) [@Duy\_Thang](https://forum.ansible.com/u/Duy_Thang)\
**Post date:** [April 30, 2012, 9:32am UTC](https://forum.ansible.com/t/typeerror-when-using-include/11455/4 "2012-04-30T09:32:27Z")

</div>

It works. Thank you very much.
