Set fact with dynamic key name in ansible

Question:

I am trying to shrink several chunks of similar code which looks like:

The only difference between them is list name instead of my_list.

In fact, I want to do this:

Is it possible to do so or is there any workaround?

Answer:

take a look at this sample playbook:

Leave a Reply