Jinja2 - Cisco Access-list

13 views
Skip to first unread message

Juraj Papic

unread,
Aug 28, 2017, 3:06:03 PM8/28/17
to ansible...@googlegroups.com
Hi all

I searching for a Jinja2 that can help me with my cisco router acls.

And I found this but not sure if this will help me create my acls

{% for key, value in vars['access_lists']|dictsort(false, 'key') %}
{% if value['type'] == 'standard' %}
{% for entry in value['entries'] %}
{% if 'action' in entry %}
{% if entry['source_wildcard'] == '0.0.0.0' %}
- parents:
  lines:
  - access-list {{ value['number'] }} {{ entry['action'] }}{{ entry['whitespace'] }}{{ entry['source_network'] }}
{% elif entry['source_network'] == 'any' %}
- parents:
  lines:
  - access-list {{ value['number'] }} {{ entry['action'] }}{{ entry['whitespace'] }}{{ entry['source_network'] }}
{% else %}
- parents:
  lines:
  - access-list {{ value['number'] }} {{ entry['action'] }}{{ entry['whitespace'] }}{{ entry['source_network'] }} {{ entry['source_wildcard'] }}
{% endif %}
{% endif %}
{% if 'remark' in entry %}
- parents:
  lines:
  - access-list {{ value['number'] }} remark {{ entry['remark'] }}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}

Any ideas?

Thanks

--

Juraj A Papic
Reply all
Reply to author
Forward
0 new messages