Group vars lookup pipe

In my group_vars folder , I have a file which has the following

scheduletime: 2016-09-01 08:41:15

stime: “{{lookup(‘pipe’,‘date +%Y-%m-%dT%H:%M:%SZ -d ‘+{{ scheduletime }}+’’)}}”

I want to provide human readable time via scheduletime and then convert it into iso 8601 format

the following works on linux: date +%Y-%m-%dT%H:%M:%SZ -d “2016-09-01 08:41:15”

tryin to represent the same in ansible group_vars.

fatal: [localhost] => Failed to template {{stime}}: Failed to template {{lookup(‘pipe’,‘date +%Y-%m-%dT%H:%M:%SZ -d ‘+{{ scheduletime }}+’’)}}: template error while templating string: expected token ‘:’, got ‘}’

I have tried many combinations of quotes, double quotes, but cannot seem to get it to work.

Try escaping the single quotes and the colons.

Maybe run the task without using the variable, and just put a sample
value after the ...-d '+... Maybe you might need to quote that value
or escape it somehow. Finding out is easier without using a variable.

Johannes