k8s_firewalld.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Copyright 2021 Dell Inc. or its subsidiaries. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. ---
  15. - name: Install firewalld
  16. package:
  17. name: firewalld
  18. state: present
  19. - name: Start and enable firewalld
  20. service:
  21. name: firewalld
  22. state: started
  23. enabled: yes
  24. - name: Configure firewalld on master nodes
  25. firewalld:
  26. port: "{{ item }}/tcp"
  27. permanent: yes
  28. state: enabled
  29. with_items: '{{ k8s_master_ports }}'
  30. - name: Open calico UDP ports on the firewall
  31. firewalld:
  32. port: "{{ item }}/udp"
  33. permanent: yes
  34. state: enabled
  35. with_items: "{{ calico_udp_ports }}"
  36. - name: Open calico TCP ports on the firewall
  37. firewalld:
  38. port: "{{ item }}/tcp"
  39. permanent: yes
  40. state: enabled
  41. with_items: "{{ calico_tcp_ports }}"
  42. - name: Reload firewalld
  43. command: firewall-cmd --reload
  44. changed_when: true
  45. - name: Stop and disable firewalld
  46. service:
  47. name: firewalld
  48. state: stopped
  49. enabled: no