aboutsummaryrefslogtreecommitdiffstats
path: root/roles/pf/tasks/main.yml
blob: 826353994c33a6a70420b42083bb2f2ddd89d5fe (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

# pf ~~ tasks/main.yml

---

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

- name: enable pf
  shell: /sbin/pfctl -e
  register: result
  failed_when: result.rc != 0 and "already enabled" not in result.stderr

- 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

remember that computers suck.