maybe it's because of the multiline output? you should try it with stdout_lines instead of stdout, you'd probably have to change your regexp parameter to an insertafter
- name: Add ssh config to ~/.ssh/config lineinfile: path=~/.ssh/config line={{ item }} insertafter="^Host vagrantguest\n.*\n" with_items: vagrant_ssh_config.stdout_lines On Saturday, August 2, 2014 8:42:13 PM UTC+2, Synaesthete wrote: > > I checked and on a debug message do not see single-quotes in the stdout. > Adding the | safe also didn't help. So it seems that still either jinja or > ansible is throwing single-quotes around the variable data before writing > it to file. I don't see this same behavior when writing the same block > using the template module, so this may be specific to lineinfile. > > I'm running the most recent build, v1.7 > > > > On Saturday, August 2, 2014 2:24:44 PM UTC-4, Michael DeHaan wrote: >> >> Let me know what version of Ansible you are running? >> >> In light of some security fixes, it took a few revs to nail quoting in >> some cases. >> >> All being said, 1.6.10 is good stuff on that front. >> >> >> >> >> On Sat, Aug 2, 2014 at 1:16 PM, Amr Ali <amre...@gmail.com> wrote: >> >>> This is strange, does the output itself have the quotes or it gets added >>> by jinja? can you post the "vagrant_ssh_config" output? >>> >>> maybe you can try doing this it will stop jinja from automatically >>> escaping your variables based on your environment : >>> >>> {{ vagrant_ssh_config.stdout | safe }} >>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Ansible Project" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to ansible-proje...@googlegroups.com. >>> To post to this group, send email to ansible...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/ansible-project/62c15bc7-768e-485c-8850-557c4ef14251%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/ansible-project/62c15bc7-768e-485c-8850-557c4ef14251%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3be012d5-16d2-405e-9176-f954ce29d8b6%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.