Last active
August 29, 2015 14:12
-
-
Save amiorin/c35549f1ff159580001c to your computer and use it in GitHub Desktop.
Ansible idempotent iptables add rule
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Check forward udp port 53 | |
command: iptables -t nat -C PREROUTING -i {{ eth }} -p udp --dport 53 -j REDIRECT --to-port 8600 | |
register: result | |
failed_when: False | |
changed_when: False | |
when: server | |
tags: iptables | |
- name: Forward udp port 53 | |
command: iptables -t nat -A PREROUTING -i {{ eth }} -p udp --dport 53 -j REDIRECT --to-port 8600 | |
when: server and result|failed | |
tags: iptables | |
- name: Check forward udp port 53 localhost | |
command: iptables -t nat -C OUTPUT -o lo -p udp --dport 53 -j REDIRECT --to-ports 8600 | |
register: result | |
failed_when: False | |
changed_when: False | |
when: server | |
tags: iptables | |
- name: Forward udp port 53 localhost | |
command: iptables -t nat -A OUTPUT -o lo -p udp --dport 53 -j REDIRECT --to-ports 8600 | |
when: server and result|failed | |
tags: iptables |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment