add mongodb-firewall role for iptables rules

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-07-31 13:48:13 -04:00
parent aa5c854732
commit 08e02096c8
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
4 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,3 @@
# Description
This role simply open the TCP port in `iptables` based on value of `mongodb_net_port`.

View File

@ -0,0 +1,2 @@
---
mongodb_net_port: 27017

View File

@ -0,0 +1,3 @@
---
- name: Save iptables rules
shell: iptables-save > /etc/iptables/rules.v4

View File

@ -0,0 +1,10 @@
---
- name: Enable MongoDB port
iptables:
comment: 'MongoDB'
jump: ACCEPT
source: '0.0.0.0/0'
protocol: 'tcp'
destination_port: '{{ mongodb_net_port }}'
notify:
- Save iptables rules