main.yml 504 B

123456789101112131415161718
  1. - name: Configure ufw defaults
  2. ufw: direction={{ item.direction }} policy={{ item.policy }}
  3. with_items:
  4. - { direction: 'incoming', policy: 'deny' }
  5. - { direction: 'outgoing', policy: 'allow' }
  6. - name: Allow (limit) ssh
  7. ufw: rule=limit port=22 proto=tcp
  8. - name: Include nginx hosts
  9. include_vars: nginx_hosts.yml
  10. - name: Allow nginx to access the backend
  11. ufw: rule=allow port=8000:8100 proto=tcp from="{{item}}"
  12. with_items: "{{nginx_hosts}}"
  13. - name: Enable ufw
  14. ufw: state=enabled