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

content argument of copy module doesn't add end of line character #7855

ryan-lane opened this Issue Jun 19, 2014 · 3 comments


None yet
2 participants

ryan-lane commented Jun 19, 2014

Issue Type:

Bug Report

Ansible Version:

ansible 1.6.3


Ubuntu 14.04


When using content='blah' for a file, the file will have 'blah' with no end of line character, which is generally an invalid file.

Steps To Reproduce:
- name: Add world to /tmp/hello
  copy: dest=/tmp/hello content='world'
Expected Results:


Actual Results:



This comment has been minimized.


jimi-c commented Jun 20, 2014

The content is verbatum, so just add a '\n' to it if you want a newline. Files without newlines are not "generally invalid", as there are plenty of config files that do not end with a newline. If you have any further questions regarding this, please let us know. Thanks!

@jimi-c jimi-c closed this Jun 20, 2014


This comment has been minimized.

ryan-lane commented Jun 20, 2014

POSIX states that text files should end with a newline to specify end of file. It might be a problem for this to be the default for people writing binary into their files via content (do people actually do this?) but for the vast majority of cases the module is likely writing POSIX in-compliant files.


This comment has been minimized.


jimi-c commented Jun 20, 2014

Feel free to send in a PR to check for a newline at the end of content, and to add one if it doesn't exist.

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