glad it worked for you, someone more experienced with the code can probably 
tell why it's wrapping multilines in quotes, not sure if it's a python 
thing or an issue with the lineinfile module or even with how ansible 
registers multiline outputs.

if you have the time maybe you can test something - not even sure if this 
will work haven't tried joining jinja varaibles using a newling before..

- name: Add ssh config to ~/.ssh/config
  lineinfile: path=~/.ssh/config line={{ vagrant_ssh_config.stdout_lines | 
join('\n') }} regexp="^Host vagrantguest\n.*\n"





On Saturday, August 2, 2014 6:26:54 PM UTC+2, Synaesthete wrote:
>
> Some quick background. I'm using ansible to automate setup of development 
> environments for new projects. These are active development environments, 
> not freshly provisioned machines, so some challenges come with the 
> territory--in particular there are times when I would use a template to 
> configure a new machine, but in an active dev environment I have to modify 
> existing config files.
>
> In one case I am configuring the ~/.ssh/config file to make it possible to 
> SSH in to a vagrant box using a regular 'ssh vagrantguest' by taking the 
> resulting config block from 'vagrant ssh-config'. This is a multi-line 
> block. I have a playbook that does something like this:
>
> - name: Retrieve ssh config from vagrant
>   shell: vagrant ssh-config --host vagrantguest chdir={{ project_path }}
>   changed_when: False
>   register: vagrant_ssh_config
>
> - name: Add ssh config to ~/.ssh/config
>   lineinfile: path=~/.ssh/config line={{ vagrant_ssh_config.stdout }} 
> regexp="^Host vagrantguest\n.*\n"
>
> The variable, vagrant_ssh_config.stdout is added to the file but is 
> surrounded in single-quotes. Is this a bug or expected behavior? Is there a 
> way to remove these quotes? Or is there a better solution to this 
> altogether?
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c361135c-d68c-4092-97fc-4bc93dd71c66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to