I am having a bit of a problem, and haven't found a way around it, and my
google searches thus far have come up with solutions that haven't worked.


Task:
 i am writing a role to install/manage our iptables rulesets on our linux
servers.  I am creating the file with the rules using a jinja2 template.
Some of our servers have more network interfaces than others,  so I am
trying to use the ansible_interfaces fact to list out the interfaces (
minus the loopback) and have a for loop in the jinja template to create the
rule for that interface.

Issue:
When I run the playbook for a particular host, the first, time everything
looks as expected.  When I run it a second time, the task still gets marked
as "changed" even though nothing has changed.  I do know that the output of
the ansible_interfaces isn't in the same order each time, so I tried using
a sort filter as well, which didn't help.  (see jinja code below)

{% for testinterface in ansible_interfaces|difference(['lo'])|sort %}
Some rule with the interface labled: {{testinterface}}
{% endfor %}

Question:
Am I going about this the wrong way?  Is there a better way to do this so
that idempotency can be achieved?

Thanks for your help on this!!

--John

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAPAjob-zc3cfuhSiw%2BP%3DVkC%3Df-N_0wJxE7TqoV9gdaEmhUPZaA%40mail.gmail.com.

Reply via email to