netplugin_iptables.yml 990 B

1234567891011121314151617181920212223242526272829
  1. ---
  2. - name: Netplugin IPtables | Get iptables rules
  3. command: iptables -L --wait
  4. register: iptablesrules
  5. always_run: yes
  6. - name: Netplugin IPtables | Enable iptables at boot
  7. service:
  8. name: iptables
  9. enabled: yes
  10. state: started
  11. - name: Netplugin IPtables | Open Netmaster with iptables
  12. command: /sbin/iptables -I INPUT 1 -p tcp --dport {{ item }} -j ACCEPT -m comment --comment "contiv"
  13. with_items:
  14. - "{{ netmaster_port }}"
  15. - "{{ contiv_rpc_port1 }}"
  16. - "{{ contiv_rpc_port2 }}"
  17. - "{{ contiv_rpc_port3 }}"
  18. - "{{ contiv_etcd_port }}"
  19. - "{{ kube_master_api_port }}"
  20. when: iptablesrules.stdout.find("contiv") == -1
  21. notify: Save iptables rules
  22. - name: Netplugin IPtables | Open vxlan port with iptables
  23. command: /sbin/iptables -I INPUT 1 -p udp --dport 8472 -j ACCEPT -m comment --comment "vxlan"
  24. - name: Netplugin IPtables | Open vxlan port with iptables
  25. command: /sbin/iptables -I INPUT 1 -p udp --dport 4789 -j ACCEPT -m comment --comment "vxlan"