On Mar 28, 2015, at 9:34 PM, Vince Skahan <[email protected]> wrote: > I'm installing a piece of software that requires me to edit a user=xyz line > into a monolithic config file that is .ini like in format. > > [function-x] > # user=myuserhere > > [function-y] > # other stuff here > # more stuff here > > [function-z] > # user=myuserhere > > > So suppose I have a config that requires me to uncomment the line in > [function-Z] and substitute in the right value for the username. > > How do you specify which of the two identical lines in the file that you want > to edit ? > Any suggestions ?
Try the ini_file module (http://docs.ansible.com/ini_file_module.html) instead of lineinfile. You want something like this, I think: - ini_file: dest=/etc/anotherconf section=function-z option=user value=myuserhere backup=yes -A -- Adam Herzog [email protected] -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/FF7FE6D2-85B5-434E-8857-2804EABC76A9%40adamherzog.com. For more options, visit https://groups.google.com/d/optout.
