include_tasks vs include

64 views
Skip to first unread message

Ben Joyce

unread,
Oct 17, 2018, 5:25:23 AM10/17/18
to ansible...@googlegroups.com
Hi.  Has include_tasks been deprecated?  I have a playbook that used include_tasks fine up until recently.

ansible-playbook --version reports 2.7.0

Unfortunately I can't be sure of what the previous version was, if it was indeed different.

Either way, include_tasks no longer works for me.  I get this error:

ERROR! Invalid options for include_tasks: item

The error appears to have been in '/vagrant/workspace/pcf-automation-infrastructure/ansible/bosh/prep.yml': line 53, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


    - include_tasks: ../roles/common/tasks/download.yml item={{item}}
      ^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes.  Always quote template expression brackets when they
start a value. For instance:

    with_items:
      - {{ foo }}

Should be written as:

    with_items:
      - "{{ foo }}"

If I use include instead it works.

Any ideas?

Cheers,

Ben

Kai Stian Olstad

unread,
Oct 17, 2018, 5:37:45 AM10/17/18
to ansible...@googlegroups.com
On 17.10.2018 11:23, Ben Joyce wrote:
> Hi. Has include_tasks been deprecated? I have a playbook that used
> include_tasks fine up until recently.
>
> ansible-playbook --version reports 2.7.0
>
> Unfortunately I can't be sure of what the previous version was, if it
> was
> indeed different.
>
> Either way, include_tasks no longer works for me. I get this error:
>
> ERROR! Invalid options for include_tasks: item
>
<snip />

> Any ideas?

The documentation say that include_tasks is preview so it's subjected to
change
https://docs.ansible.com/ansible/2.7/modules/include_tasks_module.html#status


So when you upgrade you need to check the documentation again for those
module and read the porting guide.
https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_2.7.html#include-tasks-import-tasks-inline-variables

--
Kai Stian Olstad

Ben Joyce

unread,
Oct 17, 2018, 6:09:38 AM10/17/18
to ansible...@googlegroups.com
Thanks Kia.  Really appreciate your quick and detailed response.

Regards,

Ben

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1f3088c53d2685545bb50a4cb1f46f14%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Eugene Wong

unread,
Oct 18, 2018, 12:02:03 AM10/18/18
to ansible...@googlegroups.com
Hi Ben,

From the error message it could seem like double quotes are required:

item=“{{item}}”

Eugene

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Ben Joyce

unread,
Oct 19, 2018, 5:43:28 AM10/19/18
to ansible...@googlegroups.com
Hi Eugene.  I did try that suggestion but unfortunately it did not make any difference.

Regards,

Ben

Oriol Tauleria

unread,
Oct 19, 2018, 6:09:31 AM10/19/18
to ansible...@googlegroups.com
Hello Ben,
could you update the entire playbook?
The problem could be in the items list, have you tried to add quotes to each item?

El dv., 19 oct. 2018 11.43, Ben Joyce <ben....@gmail.com> va escriure:

Brian Coca

unread,
Oct 19, 2018, 10:40:20 AM10/19/18
to Ansible Project
FYI item="{{item}}" is really a noop


--
----------
Brian Coca

Ben Joyce

unread,
Oct 19, 2018, 1:06:24 PM10/19/18
to ansible...@googlegroups.com
Just googled "noop" - not quite sure what you mean, Brian... can you elaborate? :)

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Matt Martz

unread,
Oct 19, 2018, 1:15:31 PM10/19/18
to ansible...@googlegroups.com
noop == no-op == No Operation

You are setting a variable named `item` to the variable named `item`.  That is unnecessary, and does nothing for you.  Simply omitting `item={{item}}` will do the same thing.


For more options, visit https://groups.google.com/d/optout.


--
Matt Martz
@sivel
sivel.net

Ben Joyce

unread,
Oct 19, 2018, 5:08:37 PM10/19/18
to ansible...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages