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

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: Set firewall rules
  7. command: ufw allow {{ item }}
  8. register: ufw_result
  9. changed_when: "ufw_result.stdout.startswith('Rule')"
  10. with_items:
  11. - smtp/tcp
  12. - domain/tcp
  13. - http/tcp
  14. - https/tcp
  15. - ssh/tcp
  16. - ssmtp/tcp
  17. - imaps/tcp
  18. - 6697/tcp # znc
  19. - openvpn/udp
  20. - 60000:61000/udp # mosh udp packets
  21. - name: Check status of ufw
  22. command: ufw status
  23. register: ufw_status
  24. changed_when: False # never report as "changed"
  25. - name: Enable ufw
  26. command: ufw --force enable
  27. when: "ufw_status.stdout.startswith('Status: inactive')"