Skip to content

Instantly share code, notes, and snippets.

@chadgeary
Created July 26, 2021 01:50
Show Gist options
  • Select an option

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

Select an option

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