This is an extremely complex and weird conditional that will be hard for anything to read and understand what is happening. Consider simplifying it as much as you can or using set_fact beforehand to build the path to find components so you can better document it.
Split every and condition only a new entry to reduce the line length, each entry is just and’d together
The ‘~’ is a jinja2 string concatenation operator that works similar to ‘+’ but it converts both sides to a string before adding it together making it better for what you want
The reason why the warning still showed is because you still have jinja2 blocks, technically they are required in your example because you have it in a string but what you should be doing is not enclse the var in a string and concat it together
I haven’t tested this but it “should” work.