aboutsummaryrefslogtreecommitdiffstats
path: root/tasks/network.yml
blob: da194b9a0c12fa708e6fc09077de81383a98c1ca (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
- 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