Skip to content

Instantly share code, notes, and snippets.

@iamjohnnym
Created May 13, 2014 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamjohnnym/82a9570a5e96b4e3f305 to your computer and use it in GitHub Desktop.
Save iamjohnnym/82a9570a5e96b4e3f305 to your computer and use it in GitHub Desktop.
- name: Setup default firewall rules
command: "/sbin/iptables -I INPUT 1 -p tcp -m tcp -m comment --comment '{{item.type}}' --dport {{item.port}} -j ACCEPT"
with_items:
- {'type':'SSH', 'port':22}
- {'type':'HTTP', 'port':80}
- {'type':'HTTPS', 'port':443}
when: ansible_os_family == 'RedHat'
- name: Setup default firewall rules
command: ufw allow {{item}}
with_items:
- 22
- 80
- 443
when: ansible_os_family == 'Debian'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment