aboutsummaryrefslogtreecommitdiffstats
path: root/tasks/network.yml
blob: 2a4ec230df46a1bfb289d075bf9d8deb330820cd (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
- name: Check existence of lan0
  shell: ifconfig lan0 || echo "failed"
  register: lan0_status

- name: Check existence of wan0
  shell: ifconfig wan0 || echo "failed"
  register: wan0_status

- name: Set up network interfaces
  shell: |
    sysrc -x ifconfig_igc0
    sysrc -x ifconfig_igc0_ipv6
    sysrc ifconfig_igc0_name="lan0"
    sysrc ifconfig_igc1_name="wan0"
    sysrc ifconfig_lan0="DHCP"
    sysrc ifconfig_lan0_ipv6="inet6 accept_rtadv"
    sysrc ifconfig_wan0="DHCP"
    sysrc ifconfig_wan0_ipv6="inet6 accept_rtadv"

- name: Restart networking if custom interfaces do not exist
  shell: service netif restart
  when: lan0_status.stdout.find('failed') != -1 or
    wan0_status.stdout.find('failed') != -1

- name: Update facts
  setup:

- name: Set up sshd
  template:
    src: etc_ssh_sshd_config.j2
    dest: /etc/ssh/sshd_config
    owner: root
    group: wheel
    mode: "0644"
  register: etc_sshd_config

- name: Restart sshd
  shell: service sshd restart
  when: etc_sshd_config.changed

- name: Disable syslogd remote listening
  shell: sysrc syslogd_flags="-s" && service syslogd restart

- name: Configure pf
  template:
    src: etc_pf.conf.j2
    dest: /etc/pf.conf
    owner: root
    group: wheel
    mode: "0644"
    backup: yes

- name: Enable and start pf
  service:
    name: pf
    enabled: true
    state: started

- name: Reload pf rules
  shell: pfctl -f /etc/pf.conf