Write multiple lines to a file using local_action

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.

copy can't do that, check out lineinfile
https://docs.ansible.com/ansible/lineinfile_module.html