Skip to content

Instantly share code, notes, and snippets.

@makentenza
Created July 5, 2018 09:45
Show Gist options
  • Save makentenza/3059b5b7d46851707b0df6aceebf567a to your computer and use it in GitHub Desktop.
Save makentenza/3059b5b7d46851707b0df6aceebf567a to your computer and use it in GitHub Desktop.
---
- name: Firewall rules for Prometheus
hosts: nodes
tasks:
- name: Ensure IPtables rule exists
lineinfile:
dest: /etc/sysconfig/iptables
state: present
line: "{{ item }}"
insertbefore: '^COMMIT'
backup: yes
with_items:
- '-A OS_FIREWALL_ALLOW -p tcp -m state --state NEW -m tcp --dport 9100 -j ACCEPT'
- '-A OS_FIREWALL_ALLOW -p tcp -m state --state NEW -m tcp --dport 1936 -j ACCEPT'
- '-A OS_FIREWALL_ALLOW -p tcp -m state --state NEW -m tcp --dport 8443 -j ACCEPT'
- name: Ensure IPtables is restarted
systemd:
state: restarted
name: iptables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment