Hi 

Over IRC Brian was very helpful last night resolving an issue.

To summarize this now works:

{% if inventory_hostname in groups.lab %}
# Lab SSH Rules
{% for host in groups.lab %}
-A INPUT -s {{ lookup('dig', host, '@dns_server')}} -p tcp -m state --state 
NEW -m tcp --dport 22 -m comment --comment "ssh from {{ host }}" -j ACCEPT
{% endfor %}
{% endif %}

Though I want to exclude some servers in groups.lab from being included in 
template.   Luckily those I want to exclude contain a particular string 
which matches subdomain.

So could I use a regex search filter to exclude any server that contains 
such string?

Eg:

{% if inventory_hostname in groups.lab |  regex_search('(!string)') %}

Thanks!
Doug


-- 
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/2f7e1e56-54a1-433c-8d53-7796deaed01c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to