[ansible-project] Re: Can ansible iterate through lines in a file?

2014-08-01 Thread Mike Ray
I've also run into this issue and haven't picked the best way to deal with it yet. You can always run that command via the shell module. Occasionally commands get a little gross and you'll have to add so many escape characters and quotes that even you can't tell what's going on. If that

[ansible-project] Re: Can ansible iterate through lines in a file?

2014-08-01 Thread John Oliver
Dozens of lines to the audit log configuration. I probably will just push a script and run it. But you're right... it's un-ansible-like :-) But so long as our scripts can be run idempotently, it isn't a total hack :-) On Friday, August 1, 2014 11:35:00 AM UTC-7, Mike Ray wrote: Out of

[ansible-project] Re: Can ansible iterate through lines in a file?

2014-08-01 Thread John Oliver
If you just call lineinfile, where will it write them? At the end? What if your target file has some kind of terminator, can you do a blanket insertbefore or insertafter? I'm not really grokking the concept of 'backrefs'. On Friday, August 1, 2014 11:33:36 AM UTC-7, Amr Ali wrote: You

Re: [ansible-project] Re: Can ansible iterate through lines in a file?

2014-08-01 Thread Outsider
Calling lineinfile without any other arguments like my example would insert the lines at the end of the file if they don't already exist. You can modify this behavior using insertbefore and insertafter, both take regex as a value, so you can determine certain sections to add the new lines to..