Skip to content

Instantly share code, notes, and snippets.

@zdw
Created February 18, 2014 01:02
Show Gist options
  • Save zdw/9062533 to your computer and use it in GitHub Desktop.
Save zdw/9062533 to your computer and use it in GitHub Desktop.
ansible example of dicts and with_items
- name: allow http traffic through firewall
lineinfile: dest=/etc/sysconfig/iptables
regexp="^-A INPUT -p {{item.protocol}} -m {{item.protocol}} --dport {{item.port}} -j ACCEPT$"
line="-A INPUT -p {{item.protocol}} -m {{item.protocol}} --dport {{item.port}} -j ACCEPT"
insertafter="^-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT$"
with_items:
- { protocol: tcp, port: 80 }
notify:
- restart iptables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment