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 846B

12345678910111213141516171819202122232425262728293031
  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. - name: Deny everything and enable UFW
  7. ufw: state=enabled policy=deny
  8. - name: Set firewall rule for DNS
  9. ufw: rule=allow port=domain
  10. - name: Set firewall rule for mosh
  11. ufw: rule=allow port=60000:61000 proto=udp
  12. - name: Set firewall rules for web traffic and SSH
  13. ufw: rule=allow port={{ item }} proto=tcp
  14. with_items:
  15. - http
  16. - https
  17. - ssh
  18. - name: Check config of ufw
  19. command: cat /etc/ufw/ufw.conf
  20. register: ufw_config
  21. changed_when: False # never report as "changed"
  22. - name: Disable logging (workaround for known bug in Debian 7)
  23. ufw: logging=off
  24. when: "ansible_lsb['codename'] == 'wheezy' and 'LOGLEVEL=off' not in ufw_config.stdout"