Created
September 17, 2015 13:10
Revisions
-
viesti created this gist
Sep 17, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ def make_rules(hosts, ports, proto): return [{"proto": proto, "from_port": port, "to_port": port, "cidr_ip": host} for host in hosts for port in map(int, ports.split(","))] class FilterModule(object): def filters(self): return {'make_rules': make_rules} usage: random_hosts: - 192.168.1.2/32 - 172.16.0.2/32 ec2_group: rules: "{{ random_hosts | make_rules('22,8080', 'tcp') }}"