I have several lineinfile statements to insert iptables rules into 
/etc/sysconfig/iptables  I'm using positional like insertbefore to get them 
in the order I want, and it works just fine on the first run.  But 
subsequent runs are not idempotent...  if I insert B before Y, and then C 
before Y, and then D before Y; then run the playbook over, it seems to see 
that the line before Y is D, and adds B again, then C, then D.

Is there a way to use positional but tell ansible that if it sees a line 
matching a regexp anywhere in the file to not execute?

Or is there another module that might be more appropriate for this?  I 
mean, I could use a shell directive to check the config file or output of 
iptables for a line matching a regexp, and if no match then insert my line, 
and then iptables-save, but that just isn't as neat as using the lineinfile 
module :-)

-- 
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/19a53745-1787-440f-86a1-0bec950ead7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to