library/roles/iptables/tasks/main.yml: Ubuntu 16.04 uses netfilter-persistent and systemd.

This commit is contained in:
Andrea Dell'Amico 2018-02-17 12:44:03 +01:00
parent 8956395965
commit 528a01ec4a
1 changed files with 11 additions and 0 deletions

View File

@ -55,6 +55,17 @@
register: install_netfilter_rules
tags: [ 'iptables', 'iptables_rules' ]
- name: Install the IPv4 and IPv6 iptables rules. The IPv6 ones are not used. On Ubuntu >= 16.04
template: src=iptables-{{ item }}.j2 dest=/etc/iptables/{{ item }} owner=root group=root mode=0640
with_items:
- rules.v4
- rules.v6
when:
- ansible_distribution is 'Ubuntu'
- ansible_distribution_major_version >= '16'
register: install_netfilter_rules
tags: [ 'iptables', 'iptables_rules' ]
- name: Start the iptables service immediately after the new rules have been installed, on Ubuntu precise. This can have an impact on other tasks
service: name=iptables-persistent state=restarted enabled=yes
notify: Restart fail2ban