No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ufw.yml 885B

123456789101112131415161718192021222324252627282930313233343536
  1. ---
  2. # Installs and configures ufw, which in turn uses iptables for firewall management
  3. # ufw includes sensible icmp defaults
  4. - name: Install ufw
  5. apt: pkg=ufw state=present
  6. tags:
  7. - dependencies
  8. - name: Deny everything
  9. ufw: policy=deny
  10. - name: Set firewall rule for DNS
  11. ufw: rule=allow port=domain
  12. - name: Set firewall rule for mosh
  13. ufw: rule=allow port=60000:61000 proto=udp
  14. - name: Set firewall rules for web traffic and SSH
  15. ufw: rule=allow port={{ item }} proto=tcp
  16. with_items:
  17. - http
  18. - https
  19. - ssh
  20. - name: Enable UFW
  21. ufw: state=enabled
  22. - name: Check config of ufw
  23. command: cat /etc/ufw/ufw.conf
  24. register: ufw_config
  25. changed_when: False # never report as "changed"
  26. - name: Disable logging (workaround for known bug in Debian 7)
  27. ufw: logging=off
  28. when: "ansible_lsb['codename'] == 'wheezy' and 'LOGLEVEL=off' not in ufw_config.stdout"