Ansible template error: "TypeError: unsupported operand type(s) for -: 'StrictUndefined' and 'StrictUndefined'"

Hello,
I have a task like this:

  • name: my configuration files
    template: src={{ item }} dest=/etc/myapp/{{ item }} owner=myuser group=myuser mode=0644
    tags: config
    with_items:
  • hive-site.xml
  • my-app.properties

When I ran the playbook, I got an error:

TASK: [my configuration files] ********************************************** 
fatal: [192.168.1.1] => {'msg': "TypeError: unsupported operand type(s) for -: 'StrictUndefined' and 'StrictUndefined'", 'failed': True}
fatal: [192.168.1.1] => {'msg': 'One or more items failed.', 'failed': True, 'changed': False, 'results': [{'msg': "TypeError: unsupported operand type(s) for -: 'StrictUndefined' and 'StrictUndefined'", 'failed': True}]}

I read this open issue:
https://github.com/ansible/ansible/issues/9773

which seems related to mine.

Anyone knows any workaround? I can’t rename the file easily.