[WARNING]: "register" is not templatable, but we found:

Hello,

I’m trying to register a var through a dynamical use of “register” (I mean : using a var, like : register: {{ var }}).

Dev updated the code and removed this option (now static only).
I’m not able to find more information about that change and also there is nobody connected on the IRC so, I post here.

Bug report (closed without real details) :
https://github.com/ansible/ansible/issues/57839

Code change :
https://gitlab.ics.muni.cz/242618/ansible/commit/be776daefed047f0bd45d7441efde046677fd417

The very detailed comment about that (from the bug report) :

Hello,

I'm trying to register a var through a dynamical use of "register" (I mean : using a var, like : register: {{ var }}).

Dev updated the code and removed this option (now static only).
I'm not able to find more information about that change and also there is nobody connected on the IRC so, I post here.

It was likely never documented. You can append a "set_fact" task to alleviate that.

Regards
        Racke

Let me add a quick update :

  • I’m trying to process several paths
  • paths are grouped and so, there are several “list” of paths (because need to generate from template and it’s different regarding the list)
  • objective was to use an compact / easier code (instead of copy existing task for a new list, just use kind of “function” … = include and loop)

register has never been templatable. Previously it would create a literal variable called {{ var }} which included the brackets.

When looping and using register, see https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#registering-variables-with-a-loop

Interesting, I also just found that.

I did try that :