Error with jinja2 templating for a conditional

Hello,

Will someone please help me understand why this is not work?

Thanks!

You cannot use a variable as the name of the var to be registered. It must be an explicit static string.

See the following info on the structure of registered data when using a loop:

https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#using-register-with-a-loop