include_tasks vs include

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

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

Thanks Kia. Really appreciate your quick and detailed response.

Regards,

Ben

Hi Ben,

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

item=“{{item}}”

Eugene

Hi Eugene. I did try that suggestion but unfortunately it did not make any difference.

Regards,

Ben

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.joyce@gmail.com> va escriure:

FYI item="{{item}}" is really a noop

Just googled “noop” - not quite sure what you mean, Brian… can you elaborate? :slight_smile:

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.

Thanks Matt, appreciated.