# Write multiple lines to a file using local\_action

**URL:** <https://forum.ansible.com/t/write-multiple-lines-to-a-file-using-local-action/21836>\
**Category:** Ansible Project\
**Created:** [June 22, 2016, 6:32pm UTC](https://forum.ansible.com/t/write-multiple-lines-to-a-file-using-local-action/21836 "2016-06-22T18:32:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamesvader13](https://avatars.discourse-cdn.com/v4/letter/j/e9bcb4/32.png) [@jamesvader13](https://forum.ansible.com/u/jamesvader13)\
**Post date:** [June 22, 2016, 6:32pm UTC](https://forum.ansible.com/t/write-multiple-lines-to-a-file-using-local-action/21836/1 "2016-06-22T18:32:53Z")

</div>

I am using the command:

- local\_action: copy content=“The installation failed” dest=~/ansible/ansible\_log.txt

However, when I do it again:

- local\_action: copy content=“Contact me for assistance” dest=~/ansible/ansible\_log.txt

It overwrites the new text with the old text. What I want to do is append to the file instead of replacing the previous text.

I tried adding in a /n to the end of the original string to no avail.

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [June 22, 2016, 7:08pm UTC](https://forum.ansible.com/t/write-multiple-lines-to-a-file-using-local-action/21836/2 "2016-06-22T19:08:47Z")

</div>

copy can't do that, check out lineinfile  
[https://docs.ansible.com/ansible/lineinfile\_module.html](https://docs.ansible.com/ansible/lineinfile_module.html)
