How do I prevent ansible templates from being confused by the content they receive?
Escaping certain characters is going to be difficult, because not only would the uri module need to support that, but the templating engine engine would have to unescape as well.
Instead, here's a workaround:
Modify the task so the content is saved to a file instead of a variable:
- name: retrieve new wordpress keys and salts uri: url: "https://api.wordpress.org/secret-key/1.1/salt/" method: GET dest: wp_keys.php return_content: yes
Then add a line to your wp-config.php.j2 template that includes wp_keys.php
.