summaryrefslogtreecommitdiffstats
path: root/roles/contiv/tasks/netplugin_iptables.yml
blob: 8c348ac677254c489a643596f6edc58e63eece8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
---
- name: Netplugin IPtables | Get iptables rules
  command: iptables -L --wait
  register: iptablesrules
  always_run: yes

- name: Netplugin IPtables | Enable iptables at boot
  service:
    name: iptables
    enabled: yes
    state: started

- name: Netplugin IPtables | Open Netmaster with iptables
  command: /sbin/iptables -I INPUT 1 -p tcp --dport {{ item }} -j ACCEPT -m comment --comment "contiv"
  with_items:
  - "{{ netmaster_port }}"
  - "{{ contiv_rpc_port1 }}"
  - "{{ contiv_rpc_port2 }}"
  - "{{ contiv_rpc_port3 }}"
  - "{{ contiv_etcd_port }}"
  - "{{ kube_master_api_port }}"
  when: iptablesrules.stdout.find("contiv") == -1
  notify: Save iptables rules

- name: Netplugin IPtables | Open vxlan port with iptables
  command: /sbin/iptables -I INPUT 1 -p udp --dport 8472 -j ACCEPT -m comment --comment "vxlan"

- name: Netplugin IPtables | Open vxlan port with iptables
  command: /sbin/iptables -I INPUT 1 -p udp --dport 4789 -j ACCEPT -m comment --comment "vxlan"