firewalld.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. ---
  2. - name: Fail - Firewalld is not supported on Atomic Host
  3. fail:
  4. msg: "Firewalld is not supported on Atomic Host"
  5. when: r_os_firewall_is_atomic | bool
  6. - name: Install firewalld packages
  7. package:
  8. name: firewalld
  9. state: present
  10. register: result
  11. until: result | success
  12. - name: Ensure iptables services are not enabled
  13. systemd:
  14. name: "{{ item }}"
  15. state: stopped
  16. enabled: no
  17. masked: yes
  18. with_items:
  19. - iptables
  20. - ip6tables
  21. register: task_result
  22. failed_when: task_result|failed and 'could not' not in task_result.msg|lower
  23. - name: Wait 10 seconds after disabling iptables
  24. pause:
  25. seconds: 10
  26. when: task_result | changed
  27. - name: Start and enable firewalld service
  28. systemd:
  29. name: firewalld
  30. state: started
  31. enabled: yes
  32. masked: no
  33. daemon_reload: yes
  34. register: result
  35. - name: need to pause here, otherwise the firewalld service starting can sometimes cause ssh to fail
  36. pause:
  37. seconds: 10
  38. when: result | changed
  39. - name: Restart polkitd
  40. systemd:
  41. name: polkit
  42. state: restarted
  43. when: result | changed
  44. # Fix suspected race between firewalld and polkit BZ1436964
  45. - name: Wait for polkit action to have been created
  46. command: pkaction --action-id=org.fedoraproject.FirewallD1.config.info
  47. ignore_errors: true
  48. register: pkaction
  49. changed_when: false
  50. until: pkaction.rc == 0
  51. retries: 6
  52. delay: 10