Ansible 2.7 include_tasks no longer accepts a variable


Each of the roles in my playbook ends with this code:

Which is used (at the end of the playbook) to write a log on the target server,
indicating when a PB was started (there’s a task at the start of the PB for that), what roles ran, and when (the start and end-times are the same, but that’s for another day).

The problem is that with Ansible 2.7, I’m now getting an error caused by the line above:

This worked up until 2.7, and is useful – I’d hate to have to lose it. I’ve tried putting quotes around the “includes…}}” part of the line, to no avail.

PS I know that Ansible can write logs – I find this more useful. Also, I’m aware that include_tasks is marked ‘preview’, so may change, but I can’t find release notes to tell me if it has.


The usage has been changed in Ansible 2.7.

OLD In Ansible 2.6 (and earlier) the following was valid syntax for specifying variables:

NEW In Ansible 2.7 the task should be changed to use the vars keyword:

Check out the Porting Guide for more details

Leave a Reply