aboutsummaryrefslogtreecommitdiffstats
path: root/roles/pf/tasks/main.yml
blob: 51471c5e351e8ae3460c939154fe8ad533c4e00e (plain) (blame)
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

# pf ~~ tasks/main.yml

---

- name: Generate pf configuration
  template:
    src: templates/pf.conf.j2
    dest: /etc/pf.conf
    owner: root
    group: "{{ group_root }}"
    mode: "0600"

- name: Enable pf
  shell: /sbin/pfctl -e
  ignore_errors: true

- name: Restart pf
  shell: /sbin/pfctl -f /etc/pf.conf

- name: Test ssh connection on new pf rule
  wait_for:
    port: 22
    delay: 2
    state: started

- name: Add cron job for pf
  cron:
    cron_file: /etc/crontab
    name: "Reload pf configuration"
    user: root
    job: "/sbin/pfctl -f /etc/pf.conf > /dev/nul 2>&1"
    minute: "*"

remember that computers suck.