summaryrefslogtreecommitdiffstats
path: root/roles/contiv/tasks/netmaster_iptables.yml
blob: 2d0fb95aeacbcad33a8deba06535c1551df0747f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
---
- name: Netmaster IPtables | Get iptables rules
  command: iptables -L --wait
  register: iptablesrules
  always_run: yes

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

- name: Netmaster 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 }}"
  when: iptablesrules.stdout.find("contiv") == -1
  notify: Save iptables rules