diff --git a/iptables/tasks/main.yml b/iptables/tasks/main.yml index 892fb731..c242b0b2 100644 --- a/iptables/tasks/main.yml +++ b/iptables/tasks/main.yml @@ -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