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
You could simply join not only by , but also add the prefix together with it. Now that's not very pythonic or sophisticated but a very simple working solution:
join
,
[rabbitmq@{{ play_hosts | join(', rabbitmq@') }}]