diff --git a/roles/2-common/templates/iiab-startup.sh b/roles/2-common/templates/iiab-startup.sh index cd540334b..b2bfeb397 100644 --- a/roles/2-common/templates/iiab-startup.sh +++ b/roles/2-common/templates/iiab-startup.sh @@ -15,9 +15,9 @@ 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 = True" /etc/iiab/iiab.ini) ]]; + ! $(grep "^HOSTAPD_ENABLED=True" /etc/iiab/iiab.env) ]]; # NEGATED LOGIC HELPS FORCE PROMISCUOUS MODE EARLY IN INSTALL - # (when computed_network.yml has not yet populated iiab.ini) + # (when network/tasks/main.yml hasn't yet populated iiab.env) # RESULT: WiFi-installed IIAB should have wlan0 properly in # promiscuous mode Even On Reboots (if 2-common completed!) diff --git a/roles/network/tasks/main.yml b/roles/network/tasks/main.yml index 1735dcc91..7300081d4 100644 --- a/roles/network/tasks/main.yml +++ b/roles/network/tasks/main.yml @@ -11,14 +11,24 @@ no_net_restart: True # used below in (1) sysd-netd-debian.yml, # (2) debian.yml, (3) rpi_debian.yml when: discovered_wireless_iface == iiab_wan_iface and not reboot_to_AP -# EITHER WAY: hostapd_enabled's state is RECORDED into /etc/iiab/iiab.ini -# (by computed_ntetwork.yml below) for later use by... +# EITHER WAY: hostapd_enabled's state is RECORDED into /etc/iiab/iiab.env +# (happens just below) for later use by... # /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: Record HOSTAPD_ENABLED to /etc/iiab/iiab.env + lineinfile: + dest: /etc/iiab/iiab.env + regexp: '^HOSTAPD_ENABLED=*' + line: 'HOSTAPD_ENABLED={{ hostapd_enabled }}' + state: present + #when: not installing #REMOVE THIS LINE IF installing IS ALWAYS false AS SET IN roles/0-init/defaults/main.yml + tags: + - network + #- name: RPi - reboot to AP post install - installed via wifi so the services are ready # set_fact: # iiab_lan_iface: br0 diff --git a/roles/network/templates/network/iiab-hotspot-off b/roles/network/templates/network/iiab-hotspot-off index ebd04eeb2..31b1d5ffc 100755 --- a/roles/network/templates/network/iiab-hotspot-off +++ b/roles/network/templates/network/iiab-hotspot-off @@ -16,4 +16,4 @@ 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 +sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=False/" /etc/iiab/iiab.env diff --git a/roles/network/templates/network/iiab-hotspot-on b/roles/network/templates/network/iiab-hotspot-on index 9c17a4828..bb264ca92 100755 --- a/roles/network/templates/network/iiab-hotspot-on +++ b/roles/network/templates/network/iiab-hotspot-on @@ -17,4 +17,6 @@ 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 +sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=True/" /etc/iiab/iiab.env + +echo -e "\nPlease consider rebooting now.\n"