2017-11-23 03:15:22 +00:00
|
|
|
# sysd-netd-debian.yml
|
|
|
|
- name: Copy the bridge script - Creates br0
|
|
|
|
template:
|
|
|
|
dest: /etc/systemd/network/IIAB-Bridge.netdev
|
|
|
|
src: network/systemd-br0.j2
|
2018-05-02 23:39:53 +00:00
|
|
|
when: iiab_lan_iface == "br0"
|
2017-11-23 03:15:22 +00:00
|
|
|
|
|
|
|
- name: Copy the bridge script - Assigns IP address
|
|
|
|
template:
|
|
|
|
dest: /etc/systemd/network/IIAB-Bridge.network
|
|
|
|
src: network/systemd-br0-network.j2
|
2018-05-02 23:39:53 +00:00
|
|
|
when: iiab_lan_iface == "br0"
|
2017-11-23 03:15:22 +00:00
|
|
|
|
2020-04-04 10:09:03 +00:00
|
|
|
# can be more than one wired interface
|
|
|
|
- name: Wired enslaving - Assigns lan_list_results to br0 as wired slaves if present
|
2017-11-23 03:15:22 +00:00
|
|
|
template:
|
|
|
|
src: network/systemd-br0-slave.j2
|
2020-04-04 10:09:03 +00:00
|
|
|
dest: /etc/systemd/network/IIAB-Slave-{{ item|trim }}.network
|
|
|
|
with_items:
|
|
|
|
- "{{ lan_list_result.stdout_lines }}"
|
2020-04-13 13:29:47 +00:00
|
|
|
when: iiab_wired_lan_iface is defined and num_lan_interfaces|int >= 1 and not network_manager_active
|
2017-11-23 03:15:22 +00:00
|
|
|
|
2018-12-13 09:09:15 +00:00
|
|
|
- name: Remove static WAN template
|
|
|
|
file:
|
|
|
|
state: absent
|
|
|
|
dest: /etc/systemd/network/IIAB-Static.network
|
|
|
|
when: wan_ip == "dhcp"
|
2018-05-03 12:51:25 +00:00
|
|
|
|
2018-05-12 22:08:07 +00:00
|
|
|
- name: Static IP computing CIDR
|
|
|
|
shell: netmask {{ wan_ip }}/{{ wan_netmask }} | awk -F "/" '{print $2}'
|
|
|
|
register: CIDR
|
2018-05-13 04:10:41 +00:00
|
|
|
when: wan_ip != "dhcp"
|
|
|
|
|
|
|
|
- name: Static IP setting CIDR
|
|
|
|
set_fact:
|
|
|
|
wan_cidr: "{{ CIDR.stdout }}"
|
|
|
|
when: wan_ip != "dhcp"
|
2018-05-12 22:08:07 +00:00
|
|
|
|
2020-04-30 05:59:54 +00:00
|
|
|
- name: Supply static WAN template when network_manager_active is False
|
2018-05-14 02:12:25 +00:00
|
|
|
template:
|
|
|
|
dest: /etc/systemd/network/IIAB-Static.network
|
|
|
|
src: network/systemd-static-net.j2
|
2020-04-30 05:59:54 +00:00
|
|
|
when: wan_ip != "dhcp" and ( is_ubuntu_16 or not network_manager_active )
|
|
|
|
|
2019-05-24 07:06:43 +00:00
|
|
|
#when: wan_ip != "dhcp" and not is_ubuntu_18
|
2018-05-14 02:12:25 +00:00
|
|
|
|
2018-12-16 13:22:38 +00:00
|
|
|
- name: Stopping services
|
|
|
|
include_tasks: down-debian.yml
|
|
|
|
|
2017-11-23 03:15:22 +00:00
|
|
|
- name: Reload systemd
|
2018-04-07 21:45:04 +00:00
|
|
|
systemd:
|
|
|
|
daemon_reload: yes
|
2017-11-23 03:15:22 +00:00
|
|
|
|
2020-05-06 19:51:40 +00:00
|
|
|
- name: Clone wifi if needed
|
|
|
|
systemd:
|
2021-07-28 02:36:07 +00:00
|
|
|
name: iiab-clone-wifi
|
2020-05-06 19:51:40 +00:00
|
|
|
state: started
|
2020-05-09 21:21:58 +00:00
|
|
|
when: wifi_up_down and discovered_wireless_iface != "none"
|
2020-05-06 19:51:40 +00:00
|
|
|
|
2020-12-07 04:06:18 +00:00
|
|
|
- name: Enable & Restart systemd-networkd.service
|
2018-04-07 21:45:04 +00:00
|
|
|
systemd:
|
2017-11-23 03:15:22 +00:00
|
|
|
name: systemd-networkd
|
|
|
|
state: restarted
|
2020-12-07 04:06:18 +00:00
|
|
|
enabled: yes
|
|
|
|
masked: no
|
|
|
|
|
|
|
|
- name: Enable & Restart networkd-dispatcher.service
|
|
|
|
systemd:
|
|
|
|
name: networkd-dispatcher
|
|
|
|
state: restarted
|
|
|
|
enabled: yes
|
|
|
|
masked: no
|
2020-05-06 19:51:40 +00:00
|
|
|
|
2021-04-14 17:01:44 +00:00
|
|
|
- name: Restart hostapd when WiFi is present but not when using WiFi as gateway with wifi_up_down False
|
2020-05-06 19:51:40 +00:00
|
|
|
systemd:
|
|
|
|
name: hostapd
|
|
|
|
state: restarted
|
|
|
|
when: hostapd_enabled and (wifi_up_down or not no_net_restart)
|