blob: 133b6318021e75cf7d9925658bc5a27aff39b025 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
- name: Install some packages required for the firewall
apt: pkg={{ packages }}
vars:
packages:
- iptables
- netmask
- bsdutils
- name: Create directory /etc/iptables
file: path=/etc/iptables
state=directory
owner=root group=root
mode=0755
- name: Generate /etc/iptables/services
template: src=etc/iptables/services.j2
dest=/etc/iptables/services
owner=root group=root
mode=0600
- name: Copy /usr/local/sbin/update-firewall.sh
copy: src=usr/local/sbin/update-firewall.sh
dest=/usr/local/sbin/update-firewall.sh
owner=root group=staff
mode=0755
- name: Make the rulesets persistent
copy: src=etc/network/{{ item }}
dest=/etc/network/{{ item }}
owner=root group=root
mode=0755
with_items:
- if-pre-up.d/iptables
- if-post-down.d/iptables
- name: Ensure the firewall is up to date
command: /usr/local/sbin/update-firewall.sh -c
register: rv
# A non-zero return value will make ansible stop and show stderr. This
# is what we want.
changed_when: rv.rc
|