New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[copy module] inline content causes double newlines for multiline variables #9172

Closed
redbaron opened this Issue Sep 26, 2014 · 2 comments

Comments

Projects
None yet
3 participants
@redbaron

redbaron commented Sep 26, 2014

Issue Type:

Bug Report

Ansible Version:

1.7.2

Environment:

N/A

Summary:

when using copy module with inline content="{{myvar}}" where myvar is multiline variable, newlines in the destination files got duplicated.

Steps to reproduce

Example playbook:


---
- hosts: all
  vars:
    multiline: |
       line1
       line2
       line3

  tasks:
    - local_action: copy dest=/tmp/output content="{{multiline}}"

Run as:

ansible-playbook -c local -i "127.0.0.1," content_newlines.yml

Expected result

$ cat /tmp/output
line1
line2
line3

Actual results

$ cat /tmp/output
line1

line2

line3

@ansibot

This comment has been minimized.

Show comment
Hide comment
@ansibot

ansibot Sep 26, 2014

Contributor

Can You Help Us Out?

Thanks for filing a ticket! I am the friendly GitHub Ansibot.

It looks like you might not have filled out the issue description based on our standard issue template. You might not have known about that, and that's ok too, we'll tell you how to do it.

We have a standard template because Ansible is a really busy project and it helps to have some standard information in each ticket, and GitHub doesn't yet provide a standard facility to do this like some other bug trackers. We hope you understand as this is really valuable to us!.

Solving this is simple: please copy the contents of this template and paste it into the description of your ticket. That's it!

If You Had A Question To Ask Instead

If you happened to have a "how do I do this in Ansible" type of question, that's probably more of a user-list question than a bug report, and you should probably ask this question on the project mailing list instead.

However, if you think you have a bug, the report is the way to go! We definitely want all the bugs filed :) Just trying to help!

About Priority Tags

Since you're here, we'll also share some useful information at this time.

In general tickets will be assigned a priority between P1 (highest) and P5, and then worked in priority order. We may also have some follow up questions along the way, so keeping up with follow up comments via GitHub notifications is a good idea.

Due to large interest in Ansible, humans may not comment on your ticket immediately.

Mailing Lists

If you have concerns or questions, you're welcome to stop by the ansible-project or ansible-development mailing lists, as appropriate. Here are the links:

Thanks again for the interest in Ansible!

Contributor

ansibot commented Sep 26, 2014

Can You Help Us Out?

Thanks for filing a ticket! I am the friendly GitHub Ansibot.

It looks like you might not have filled out the issue description based on our standard issue template. You might not have known about that, and that's ok too, we'll tell you how to do it.

We have a standard template because Ansible is a really busy project and it helps to have some standard information in each ticket, and GitHub doesn't yet provide a standard facility to do this like some other bug trackers. We hope you understand as this is really valuable to us!.

Solving this is simple: please copy the contents of this template and paste it into the description of your ticket. That's it!

If You Had A Question To Ask Instead

If you happened to have a "how do I do this in Ansible" type of question, that's probably more of a user-list question than a bug report, and you should probably ask this question on the project mailing list instead.

However, if you think you have a bug, the report is the way to go! We definitely want all the bugs filed :) Just trying to help!

About Priority Tags

Since you're here, we'll also share some useful information at this time.

In general tickets will be assigned a priority between P1 (highest) and P5, and then worked in priority order. We may also have some follow up questions along the way, so keeping up with follow up comments via GitHub notifications is a good idea.

Due to large interest in Ansible, humans may not comment on your ticket immediately.

Mailing Lists

If you have concerns or questions, you're welcome to stop by the ansible-project or ansible-development mailing lists, as appropriate. Here are the links:

Thanks again for the interest in Ansible!

@mpdehaan

This comment has been minimized.

Show comment
Hide comment
@mpdehaan

mpdehaan Sep 27, 2014

Contributor

Hi, this is not actually a bug so much but a consequence of the way it was expressed, but I agree it may not be super clear.

The solution would be to use the "src" parameter or just the long form:

- copy:
    content: "{{ blarg }}"
    dest: /path/to/foo.file
Contributor

mpdehaan commented Sep 27, 2014

Hi, this is not actually a bug so much but a consequence of the way it was expressed, but I agree it may not be super clear.

The solution would be to use the "src" parameter or just the long form:

- copy:
    content: "{{ blarg }}"
    dest: /path/to/foo.file

@mpdehaan mpdehaan closed this Sep 27, 2014

alanorth added a commit to alanorth/ansible-personal that referenced this issue Oct 9, 2014

roles/nginx: Update TLS vhost task for Ansible > 1.7.1
Seems there is some YAML sublety that causes this syntax to insert
double spaces on the destination file... using native YAML hashes
are a workaround, see GitHub issues:

ansible/ansible#9067
ansible/ansible#9172

Signed-off-by: Alan Orth <alan.orth@gmail.com>

jamstooks added a commit to AASHE/django-gunicorn-supervisor that referenced this issue Jun 1, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment