firewalld.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 is succeeded
  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:
  23. - task_result is failed
  24. - ('could not' not in task_result.msg|lower)
  25. - name: Wait 10 seconds after disabling iptables
  26. pause:
  27. seconds: 10
  28. when: task_result is changed
  29. - name: Start and enable firewalld service
  30. systemd:
  31. name: firewalld
  32. state: started
  33. enabled: yes
  34. masked: no
  35. daemon_reload: yes
  36. register: result
  37. - name: need to pause here, otherwise the firewalld service starting can sometimes cause ssh to fail
  38. pause:
  39. seconds: 10
  40. when: result is changed
  41. - name: Restart polkitd
  42. systemd:
  43. name: polkit
  44. state: restarted
  45. when: result is changed
  46. # Fix suspected race between firewalld and polkit BZ1436964
  47. - name: Wait for polkit action to have been created
  48. command: pkaction --action-id=org.fedoraproject.FirewallD1.config.info
  49. ignore_errors: true
  50. register: pkaction
  51. changed_when: false
  52. until: pkaction.rc == 0
  53. retries: 6
  54. delay: 10