Skip to content

Instantly share code, notes, and snippets.

@iamjohnnym
Created May 13, 2014 15:50
Show Gist options
  • Select an option

  • Save iamjohnnym/82a9570a5e96b4e3f305 to your computer and use it in GitHub Desktop.

Select an option

Save iamjohnnym/82a9570a5e96b4e3f305 to your computer and use it in GitHub Desktop.

Revisions

  1. ecko created this gist May 13, 2014.
    14 changes: 14 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    - 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'