forked from ISTI-ansible-roles/ansible-roles
library/roles/iptables/tasks/main.yml: Ubuntu 16.04 uses netfilter-persistent and systemd.
This commit is contained in:
parent
8956395965
commit
528a01ec4a
|
@ -55,6 +55,17 @@
|
||||||
register: install_netfilter_rules
|
register: install_netfilter_rules
|
||||||
tags: [ 'iptables', 'iptables_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
|
- 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
|
service: name=iptables-persistent state=restarted enabled=yes
|
||||||
notify: Restart fail2ban
|
notify: Restart fail2ban
|
||||||
|
|
Loading…
Reference in New Issue