mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
commit
80e0b16845
6 changed files with 99 additions and 62 deletions
|
@ -1,26 +1,28 @@
|
||||||
- name: Does systemd startup service exist
|
- name: Does /usr/libexec/iiab-startup.sh exist?
|
||||||
stat: path="{{ systemd_location }}/iiab-startup.service"
|
stat:
|
||||||
register: startup_unit
|
path: /usr/libexec/iiab-startup.sh
|
||||||
|
register: startup_script
|
||||||
|
|
||||||
- name: Copy startup service to /etc/systemd/system
|
- name: Copy template script to /usr/libexec/iiab-startup.sh
|
||||||
template: src=iiab-startup.service
|
template:
|
||||||
dest=/etc/systemd/system/
|
src: iiab-startup.sh
|
||||||
when: startup_unit.stat.exists is defined and not startup_unit.stat.exists
|
dest: /usr/libexec/
|
||||||
|
mode: 0755
|
||||||
|
when: not startup_script.stat.exists
|
||||||
|
|
||||||
- name: Copy startup script
|
- name: Copy iiab-startup.service to {{ systemd_location }}
|
||||||
template: src=iiab-startup.sh
|
template:
|
||||||
dest=/usr/libexec/
|
src: iiab-startup.service
|
||||||
mode=0755
|
dest: "{{ systemd_location }}"
|
||||||
when: startup_unit.stat.exists is defined and not startup_unit.stat.exists
|
when: not startup_script.stat.exists
|
||||||
|
|
||||||
- name: Ask systemd to recognize the changes
|
- name: Enable & restart the systemd service after daemon-reload
|
||||||
shell: systemctl daemon-reload
|
# shell: systemctl daemon-reload
|
||||||
when: startup_unit.stat.exists is defined and not startup_unit.stat.exists
|
# shell: systemctl restart iiab-startup.service
|
||||||
|
# shell: systemctl enable iiab-startup.service
|
||||||
- name: Restart so systemd recognizes the changes
|
systemd:
|
||||||
shell: systemctl restart iiab-startup.service
|
name: iiab-startup
|
||||||
when: startup_unit.stat.exists is defined and not startup_unit.stat.exists
|
daemon_reload: yes
|
||||||
|
enabled: yes
|
||||||
- name: Enable the reload service
|
state: restarted
|
||||||
shell: systemctl enable iiab-startup.service
|
when: not startup_script.stat.exists
|
||||||
when: startup_unit.stat.exists is defined and not startup_unit.stat.exists
|
|
||||||
|
|
|
@ -5,8 +5,19 @@ if [ ! -f /etc/iiab/uuid ]; then
|
||||||
uuidgen > /etc/iiab/uuid
|
uuidgen > /etc/iiab/uuid
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Experimental/Temporary workaround for WiFi "10SEC disease"
|
# Temporary promiscuous-mode workaround for RPi's WiFi "10SEC disease"
|
||||||
|
# Set wlan0 to promiscuous on boot if needed as gateway (i.e. AP's OFF)
|
||||||
|
# Scripts iiab-hotspot-on + iiab-hotspot-off SHOULD toggle this boot flag!
|
||||||
# https://github.com/iiab/iiab/issues/638#issuecomment-355455454
|
# https://github.com/iiab/iiab/issues/638#issuecomment-355455454
|
||||||
if grep -qi raspbian /etc/*release; then ip link set dev wlan0 promisc on; fi
|
if [[ $(grep -i raspbian /etc/*release) &&
|
||||||
|
#($(grep "hostapd_enabled = False" /etc/iiab/config_vars.yml) ||
|
||||||
|
#((! $(grep "hostapd_enabled = True" /etc/iiab/config_vars.yml)) &&
|
||||||
|
$(grep "^hostapd_enabled = False" /etc/iiab/iiab.ini) ]];
|
||||||
|
#)
|
||||||
|
#)
|
||||||
|
#]];
|
||||||
|
then
|
||||||
|
ip link set dev wlan0 promisc on
|
||||||
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# ifcfg-rh acts on /etc/sys*/net*/ifcfg-* where we search for devices.
|
# ifcfg-rh acts on /etc/sys*/net*/ifcfg-* where we search for devices.
|
||||||
- name: Setting XO has WiFi gateway
|
- name: Setting XO has WiFi gateway
|
||||||
set_fact:
|
set_fact:
|
||||||
user_wan_iface: "{{ discovered_wan_iface }}"
|
user_wan_iface: "{{ discovered_wan_iface }}"
|
||||||
when: discovered_wan_iface != "none" and xo_model != "none" and has_ifcfg_gw == "none"
|
when: discovered_wan_iface != "none" and xo_model != "none" and has_ifcfg_gw == "none"
|
||||||
|
|
||||||
#- name: Checking for NetworkManager-config-server
|
#- name: Checking for NetworkManager-config-server
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
- name: XO laptop wants USB WiFi interface as AP mode
|
- name: XO laptop wants USB WiFi interface as AP mode
|
||||||
set_fact:
|
set_fact:
|
||||||
iiab_wireless_lan_iface: "{{ discovered_lan_iface }}"
|
iiab_wireless_lan_iface: "{{ discovered_lan_iface }}"
|
||||||
when: num_wifi_interfaces >= "2" and xo_model != "none" and discovered_wan_iface != "none" and discovered_wireless_iface == "eth0"
|
when: num_wifi_interfaces >= "2" and xo_model != "none" and discovered_wan_iface != "none" and discovered_wireless_iface == "eth0"
|
||||||
|
|
||||||
# static backout suppy new template file
|
# static backout suppy new template file
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
- name: Undo gui-static-wan by requesting new template file
|
- name: Undo gui-static-wan by requesting new template file
|
||||||
set_fact:
|
set_fact:
|
||||||
has_WAN: False
|
has_WAN: False
|
||||||
when: gui_static_wan_ip != "unset" and not gui_static_wan
|
when: gui_static_wan_ip != "unset" and not gui_static_wan
|
||||||
|
|
||||||
# figure out more than one interfaces to detect.
|
# figure out more than one interfaces to detect.
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
|
|
||||||
- name: Setting user_lan_iface for 'LanController' for single interface
|
- name: Setting user_lan_iface for 'LanController' for single interface
|
||||||
set_fact:
|
set_fact:
|
||||||
user_lan_iface: "{{ discovered_wan_iface }}"
|
user_lan_iface: "{{ discovered_wan_iface }}"
|
||||||
when: discovered_wan_iface != "none" and num_lan_interfaces == "0" and gui_desired_network_role is defined and gui_desired_network_role == "LanController"
|
when: discovered_wan_iface != "none" and num_lan_interfaces == "0" and gui_desired_network_role is defined and gui_desired_network_role == "LanController"
|
||||||
|
|
||||||
# override with user_wan_iface setting if no longer in auto
|
# override with user_wan_iface setting if no longer in auto
|
||||||
|
@ -108,10 +108,13 @@
|
||||||
|
|
||||||
# make it so number 2 vars should use user_wan_iface but we can cover a single
|
# make it so number 2 vars should use user_wan_iface but we can cover a single
|
||||||
# wired if dhcp fails the interface should revert to LAN, static address should
|
# wired if dhcp fails the interface should revert to LAN, static address should
|
||||||
# stick around but testing gateway response is not preformed.
|
# stick around but testing gateway response is not performed.
|
||||||
- name: User wants single wired interface as static or dhcp gateway
|
- name: User wants single wired interface as static or dhcp gateway
|
||||||
set_fact:
|
set_fact:
|
||||||
user_wan_iface: "{{ discovered_lan_iface }}"
|
user_wan_iface: "{{ discovered_wan_iface }}" # Jan 2018: Holt discovered_lan_iface was UNDEFINED on WiFi-installed
|
||||||
|
# RPi (when re-running ./iiab-network) so "discovered_wan_iface" is a
|
||||||
|
# workaround -- please see https://github.com/iiab/iiab/pull/649
|
||||||
|
# This workaround can and should evolve as IIAB 6.5 matures!
|
||||||
when: num_lan_interfaces == "1" and user_lan_iface == "auto" and user_wan_iface == "auto"
|
when: num_lan_interfaces == "1" and user_lan_iface == "auto" and user_wan_iface == "auto"
|
||||||
|
|
||||||
- name: No LAN configured - 'Appliance' mode
|
- name: No LAN configured - 'Appliance' mode
|
||||||
|
@ -154,30 +157,31 @@
|
||||||
when: adapter_count.stdout|int >= "5" and device_gw == "none" and gui_wan_iface == "unset" and gui_static_wan is defined
|
when: adapter_count.stdout|int >= "5" and device_gw == "none" and gui_wan_iface == "unset" and gui_static_wan is defined
|
||||||
|
|
||||||
- name: Add location section to config file
|
- name: Add location section to config file
|
||||||
ini_file: dest='{{ iiab_config_file }}'
|
ini_file:
|
||||||
section=computed_network
|
dest: "{{ iiab_config_file }}"
|
||||||
option='{{ item.option }}'
|
section: computed_network
|
||||||
value='{{ item.value }}'
|
option: "{{ item.option }}"
|
||||||
|
value: "{{ item.value }}"
|
||||||
with_items:
|
with_items:
|
||||||
- option: 'iiab_wan_enabled'
|
- option: iiab_wan_enabled
|
||||||
value: '{{ iiab_wan_enabled }}'
|
value: "{{ iiab_wan_enabled }}"
|
||||||
- option: 'user_wan_iface'
|
- option: user_wan_iface
|
||||||
value: '{{ user_wan_iface }}'
|
value: "{{ user_wan_iface }}"
|
||||||
- option: 'iiab_wan_iface'
|
- option: iiab_wan_iface
|
||||||
value: '{{ iiab_wan_iface }}'
|
value: "{{ iiab_wan_iface }}"
|
||||||
- option: 'iiab_lan_enabled'
|
- option: iiab_lan_enabled
|
||||||
value: '{{ iiab_lan_enabled }}'
|
value: "{{ iiab_lan_enabled }}"
|
||||||
- option: 'user_lan_iface'
|
- option: user_lan_iface
|
||||||
value: '{{ user_lan_iface }}'
|
value: "{{ user_lan_iface }}"
|
||||||
- option: 'iiab_lan_iface'
|
- option: iiab_lan_iface
|
||||||
value: '{{ iiab_lan_iface }}'
|
value: "{{ iiab_lan_iface }}"
|
||||||
- option: 'iiab_network_mode'
|
- option: iiab_network_mode
|
||||||
value: '{{ iiab_network_mode }}'
|
value: "{{ iiab_network_mode }}"
|
||||||
- option: 'hostapd_enabled'
|
- option: hostapd_enabled
|
||||||
value: '{{ hostapd_enabled }}'
|
value: "{{ hostapd_enabled }}"
|
||||||
- option: 'host_ssid'
|
- option: host_ssid
|
||||||
value: '{{ host_ssid }}'
|
value: "{{ host_ssid }}"
|
||||||
- option: 'host_wifi_mode'
|
- option: host_wifi_mode
|
||||||
value: '{{ host_wifi_mode }}'
|
value: "{{ host_wifi_mode }}"
|
||||||
- option: 'host_channel'
|
- option: host_channel
|
||||||
value: '{{ host_channel }}'
|
value: "{{ host_channel }}"
|
||||||
|
|
|
@ -11,9 +11,13 @@
|
||||||
no_net_restart: True # used below in (1) sysd-netd-debian.yml,
|
no_net_restart: True # used below in (1) sysd-netd-debian.yml,
|
||||||
# (2) debian.yml, (3) rpi_debian.yml
|
# (2) debian.yml, (3) rpi_debian.yml
|
||||||
when: discovered_wireless_iface == iiab_wan_iface and not reboot_to_AP
|
when: discovered_wireless_iface == iiab_wan_iface and not reboot_to_AP
|
||||||
# Idea, Not Without Risks: should WiFi-as-gateway detection logic
|
# EITHER WAY: hostapd_enabled's state is RECORDED into /etc/iiab/iiab.ini
|
||||||
# be encapsulated into roles/network/tasks/hostapd.yml in future?
|
# (by computed_ntetwork.yml below) for later use by...
|
||||||
# Today "./runtags hostapd" doesn't exist & "./runtags AP" is at yr own risk.
|
# /usr/libexec/iiab-startup.sh, iiab-hotspot-off & iiab-hotspot-on
|
||||||
|
#
|
||||||
|
# Separate Idea, Not Without Risks: should WiFi-as-gateway detection logic
|
||||||
|
# be encapsulated into roles/network/tasks/hostapd.yml in future? Whereas
|
||||||
|
# today "./runtags hostapd" doesn't exist & "./runtags AP" is UNSUPPORTED!
|
||||||
|
|
||||||
#- name: RPi - reboot to AP post install - installed via wifi so the services are ready
|
#- name: RPi - reboot to AP post install - installed via wifi so the services are ready
|
||||||
# set_fact:
|
# set_fact:
|
||||||
|
|
|
@ -8,6 +8,12 @@ systemctl daemon-reload
|
||||||
systemctl restart dhcpcd
|
systemctl restart dhcpcd
|
||||||
systemctl restart networking
|
systemctl restart networking
|
||||||
|
|
||||||
# Experimental/Temporary workaround for WiFi "10SEC disease"
|
# Temporary promiscuous-mode workaround for RPi's WiFi "10SEC disease"
|
||||||
|
# Set wlan0 to promiscuous when AP's OFF (for possible WiFi gateway)
|
||||||
|
# SEE ALSO iiab-hotspot-on + /usr/libexec/iiab-startup.sh
|
||||||
# https://github.com/iiab/iiab/issues/638#issuecomment-355455454
|
# https://github.com/iiab/iiab/issues/638#issuecomment-355455454
|
||||||
if grep -qi raspbian /etc/*release; then ip link set dev wlan0 promisc on; fi
|
if grep -qi raspbian /etc/*release; then
|
||||||
|
ip link set dev wlan0 promisc on
|
||||||
|
fi
|
||||||
|
|
||||||
|
sed -i -e "s/^hostapd_enabled.*/hostapd_enabled = False/" /etc/iiab/iiab.ini
|
||||||
|
|
|
@ -8,3 +8,13 @@ systemctl restart dhcpcd
|
||||||
systemctl restart networking
|
systemctl restart networking
|
||||||
systemctl start hostapd
|
systemctl start hostapd
|
||||||
systemctl start dhcpd
|
systemctl start dhcpd
|
||||||
|
|
||||||
|
# Temporary promiscuous-mode workaround for RPi's WiFi "10SEC disease"
|
||||||
|
# Disable "promiscuous" on wlan0 when AP (i.e. no WiFi gateway)
|
||||||
|
# SEE ALSO iiab-hotspot-off + /usr/libexec/iiab-startup.sh
|
||||||
|
# https://github.com/iiab/iiab/issues/638#issuecomment-355455454
|
||||||
|
if grep -qi raspbian /etc/*release; then
|
||||||
|
ip link set dev wlan0 promisc off
|
||||||
|
fi
|
||||||
|
|
||||||
|
sed -i -e "s/^hostapd_enabled.*/hostapd_enabled = True/" /etc/iiab/iiab.ini
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue