Interpolation in Jinja2 default() values

I’d like to do something like the following, but I couldn’t find anything in the docs or on the mailing list that made it clear whether this should be possible or not:

---
- name: add user keys from GitHub
  authorized_key:
    user: "{{item.user}}"
    key: "{{item.ssh_public_key | default(\"https://github.myenterprise.com/{{item.user}}.keys\")}}"
  with_items: users

When I tried to do this, I got an error message about not being able to fetch the key:

msg: Error getting key from: https://github.myenterprise.com/{# item.user #}.keys

I tried both escaping the default value with \" and using ', but got the same error each time.

Thanks!

-md

no mustache stacking!!!!

  key: "{{item.ssh_public_key |
default('https://github.myenterprise.com/’ + item.user + '.keys')}}"

Thanks Brian! For some reason I didn’t get a notification for your response, so sorry for the delay.

-md