Hi there!
I noticed that ansible seemed to have done some updating with regards to multiline variables, and I'm a little confused about the way the variables are handled now.
My use case comes from inserting private-key data into an encrypted yaml file via ansible-vault, and printing the contents via copy module's content directive. This worked great in 1.7.1, but with 1.7.2, it printed an extra newline between each line. Coincidentally, when I next deployed via ansible 1.7.2, my keys weren't working.
The format is something like:
group_vars/all.yml:key: |+
-----BEGIN PRIVATE KEY----
(private key)
(private key)
(private key)
-----END PRIVATE KEY-----
roles/tasks/main.yml:
- copy: content="{{ key }}" dest="/etc/ssl/private/key"
1.7.1 (correct):
-----BEGIN PRIVATE KEY----
(private key)
(private key)
(private key)
-----END PRIVATE KEY-----
1.7.2 (incorrect):
-----BEGIN PRIVATE KEY----
(private key)
(private key)
(private key)
-----END PRIVATE KEY-----
While looking through the github issues, there was a ticket that expressed exactly the issue I ran into:
https://github.com/ansible/ansible/issues/9172And it was resolved by following the 'long' format from:
https://github.com/ansible/ansible/issues/9067roles/tasks/main.yml (long format):
-
copy:
content: "{{ key }}"
dest: "/etc/ssl/private/key"
However, these have since been closed as 'not a bug'.
The way that multiline variables should not change no matter what format the user is using. I do not understand the difference between the two formats, why it should treat multiline variables differently, and how this is not a bug. Can someone shed some light on this issue?
Thanks!