play_hosts is a list of all machines for a play. I want to take these and use something like format() to rewrite them like rabbitmq@%s and
play_hosts
format()
rabbitmq@%s
In ansible you can use regex_replace filter:
{{ play_hosts | map('regex_replace', '^(.*)$', 'rabbitmq@\\1') | list }}