include_role with passed variable defined by template fails

I’m a bit confused how variables are defined when using include_role. A basic example follows.

/play.yml
`

  • hosts: localhost
    roles:
  • one
    `

/roles/one/tasks/main.yml
`

The template does not exist. You are using the wrong template file in your lookup call:

- stuff: "{{ lookup('template', 'role_one_template.j2') }}"

However, you have indicated the file is actually named: /roles/one/templates/role_one_template_file.j2

Sorry, that was just a typo in my example. The filenames all match.

Finally tracked the issue down to my misunderstanding of how lookup() works.

Answer here: https://groups.google.com/forum/#!topic/ansible-project/McPi-i-90yU