Closed bhcopeland closed 9 years ago
Is /n
something special for monit? I'm assuming you want a newline? A newline is \n
. Not that this change fixes the problem, I can't claim that.
Yeah, I meant /n
, not \n
. My bad.
Unfortunately, lineinfile isn't intended to work with multiple lines. http://docs.ansible.com/lineinfile_module.html
This is primarily useful when you want to change a single line in a file only. See the replace module if you want to change multiple, similar lines; for other cases, see the copy or template modules.
As the documentation says, template or replace may be better modules for you to look into. I have also used multiple lineinfile tasks one right after the other when the lines I was adding were very simple.
You can hit up the mailing list if you need more help constructing a set of tasks for your particular problem.
Hi!
Thanks very much for your interest in Ansible. It sincerely means a lot to us.
This appears to be a user question, and we'd like to direct these kinds of things to either the mailing list or the IRC channel.
If you can stop by there, we'd appreciate it. This allows us to keep the issue tracker for bugs, pull requests, RFEs and the like.
Thank you once again and we look forward to seeing you on the list or IRC. Thanks!
Issue Type:
Bug Report
Ansible Version:
ansible 1.9.1 - Arch Linux 1.9.1-1
Ansible Configuration:
Environment:
Arch Linux Deploying to Ubuntu 14.04
Summary:
When using newlines /n with lineinfile, it will duplicate lines. Whilst if I use it without \n it only adds it once.
Steps To Reproduce:
I will get duplicated lines.
Expected Results:
Once at the bottom of the file
Actual Results: