Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to allow specified ingress ports via iptables #7

Merged
merged 1 commit into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Configure and operate a basic cloud-native service: running anything from cypto
| _config_ | configuration files associated with the service to mount | `{}` |
| _configEnv_ | environment variables to set within the service runtime | `{}` |
| _ports_ | listening port information for a service | `{}` |
| _setup_iptables_ | configure IP tables to allow ingress paths | `false` |
| _hostDataDir_ | host directory to store node runtime/operational data | `/var/tmp` |
| _dataDir_ | container directory to store node runtime/operational data | `/tmp` |
| _workDir_ | operational directory to store runtime artifacts | `/var/tmp` |
Expand Down
12 changes: 12 additions & 0 deletions tasks/common/network-setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Determine service ingress port list for iptables config
ansible.builtin.set_fact:
ingressList: "{{ ingressList + [item.value.ingressPort | string] }}"
with_dict: "{{ ports }}"

- name: Allow service ingress ports in iptables setup
ansible.builtin.iptables:
chain: INPUT
protocol: tcp
destination_ports: "{{ ingressList }}"
jump: ACCEPT
4 changes: 4 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@

- name: Setup service infrastructure topology
ansible.builtin.include_tasks: "{{ setupMode }}/setup.yml"

- name: Manage networking and IP tables setup
when: setup_iptables|bool
ansible.builtin.include_tasks: "common/network-setup.yml"