Skip to content

Instantly share code, notes, and snippets.

@chadgeary
Last active July 26, 2021 01:46
Show Gist options
  • Select an option

  • Save chadgeary/c3b65416903e0aa4952256b92c709d1d to your computer and use it in GitHub Desktop.

Select an option

Save chadgeary/c3b65416903e0aa4952256b92c709d1d to your computer and use it in GitHub Desktop.
open-a-port.sh
sudo tee /opt/open-a-port.yml << EOM
---
- name: open-a-port
hosts: localhost
gather_facts: true
become: true
tasks:
- name: iptables accept myservice
iptables:
chain: INPUT
protocol: tcp
destination_port: '9999'
ctstate: 'NEW'
jump: ACCEPT
action: insert
rule_num: '6'
- name: iptables Persistent
shell: |
iptables-save
EOM
sudo ansible-playbook /opt/open-a-port.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment