Skip to content

Instantly share code, notes, and snippets.

@tgerla
Created July 24, 2014 21:44
Show Gist options
  • Save tgerla/24ad3af5a931cc55c0c8 to your computer and use it in GitHub Desktop.
Save tgerla/24ad3af5a931cc55c0c8 to your computer and use it in GitHub Desktop.
Make a template file called, say, rules-generator.j2:
{% for cidr_ip in aws_trusted_networks %}
- proto: tcp
from_port: 22
to_port: 22
cidr_ip: {% cidr_ip %}
{% endfor %}
In your playbook, do:
...
rules: "{{ lookup('template', 'rules-generator.j2')|from_yaml }}"
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment