Hello Josef,

you might have a look to the augeas role. I've not used it with ansible but
with puppet, and if you are changing a standard configuration file is
probably the best approach. Even if you don't want to use the role, use
augeas with a 'command' might also help

Javier Palacios

On Tue, Oct 20, 2015 at 11:47 PM, Josef Fortier <[email protected]>
wrote:

> Hi Esco:
>
> On Tuesday, October 20, 2015 at 3:31:11 PM UTC-5, esco real wrote:
> could you explain what exactly the problem is here? Maybe posting some
> examples with actual/ and expected results?
>
> Nothing insurmountable. Just trying to formulate in my own mind what works
> the best. I was/am able to work around the issues I'll detail, but I'd
> rather have had a uniform approach up front.
>
> First Issue: pre-existing relayhost on a handful of servers.
> I used regex: to catch the empty hosts
> Unintended result, hosts with existing relayhost had two set.
>
> Second issue: Too loose/tight regex (either or both).
> Correcting the first issue either led to duplication's or just updated the
> duplicates to uniform values.
>
> It looks like backrefs is a partial fix for this, but after a little
> reflection I realized that in this case (and many other cases like it) my
> best approach is to create two rules, one that deletes the line first, and
> then a role to add it. In particular this catches multiple lines in file.
> It's also easier to get the regex correct (i.e, "delete all other lines
> that might set the var")
>
> --
> 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/251451e7-2c36-4576-938e-acf548938978%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/251451e7-2c36-4576-938e-acf548938978%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CANsNpUQmk0o41Lf_DAeoAuzj1GVXoRdu5-OBvjzDnOX2vn2gcg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to