ansible-roles/evobackup-client/tasks/open_ssh_ports.yml
Patrick Marchand 0f7d9e9f24 Allow heterogeneous ports
This makes it a bit more annoying to define default hosts for
multiple machines, but it's not that bad and it's better than not
being able to define heterogeous ports.
2019-09-03 10:29:05 -04:00

22 lines
661 B
YAML

---
- name: Is there a Minifirewall ?
stat:
path: /etc/default/minifirewall
register: evobackup-client__minifirewall
tags:
- evobackup-client
- evobackup-client-backup-firewall
- name: Add backup SSH port in /etc/default/minifirewall
blockinfile:
dest: /etc/default/minifirewall
marker: "# {{ item.name }}"
block: |
/sbin/iptables -A INPUT -p tcp --sport {{ item.port }} --dport 1024:65535 -s {{ item.ip }} -m state --state ESTABLISHED,RELATED -j ACCEPT
with_items: "{{ evobackup-client__hosts }}"
when: evobackup-client__minifirewall.stat.exists
tags:
- evobackup-client
- evobackup-client-backup-firewall