I'm setting up a Traefik node with Ansible, and to do this I want to insert an array of trustedIps into my template. However, on inserting the array into the template, it adds a character 'u' per array element.
I think the Traefik config file expects a simple array with Strings and I think it expects double quotes, but I'm not sure about this, will try if single quotes work.
I also tried adding the safe in between the variable and the replace, but this did not seem to matter.
Now, I did find some other question about someone having the same issue and this did clear it up for me somewhat, but I'm still unsure of how to fix it in my case, as I do not loop over variables like the person in the other question did. Link to other question. Any ideas on how to implement a solution?
Anyway, to implement this, I created the following. My template entry looks like this:
trustedIPs = {{ trustedIps | safe | replace('\'', '\"') }}
And my variable looks like this:
trustedIps: ["127.0.0.1/32", "XX.XXX.X.XX"]
I expect it to look like this:
trustedIps = ["127.0.0.1/32", "XX.XXX.X.XX"]
But my result looks like this:
trustedIps = [u"127.0.0.1/32", u"XX.XXX.X.XX"]