From 86375892188ff65464535d43fa34759146e63c97 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 29 Jun 2022 22:25:01 -0500 Subject: [PATCH 1/6] Not required for normal operation --- roles/network/tasks/detected_network.yml | 39 ------------------------ 1 file changed, 39 deletions(-) diff --git a/roles/network/tasks/detected_network.yml b/roles/network/tasks/detected_network.yml index f9c239b10..01ff42e18 100644 --- a/roles/network/tasks/detected_network.yml +++ b/roles/network/tasks/detected_network.yml @@ -8,41 +8,6 @@ discovered_wan_iface: "{{ ansible_default_ipv4.alias }}" when: ansible_default_ipv4.gateway is defined -- name: "Verify gateway active: ping -c4 {{ ansible_default_ipv4.gateway }} -- using ansible_default_ipv4.gateway" - shell: ping -c4 "{{ ansible_default_ipv4.gateway }}" | grep icmp_seq=4 | wc -l - register: gw_active_test - when: discovered_wan_iface != "none" - -- name: "If gateway responded, set 'gw_active: True' and 'iiab_wan_iface: {{ discovered_wan_iface }}' -- using discovered_wan_iface" - set_fact: - iiab_wan_iface: "{{ discovered_wan_iface }}" # Same as code on Line 70 ! - gw_active: True - when: discovered_wan_iface != "none" and gw_active_test.stdout == "1" - - -# Similar to roles/www_options/tasks/main.yml prereq for iiab-refresh-wiki-docs -- name: 'Test for Internet access, using: {{ iiab_download_url }}/heart-beat.txt' - get_url: - url: "{{ iiab_download_url }}/heart-beat.txt" - dest: /tmp/heart-beat.txt - #timeout: "{{ download_timeout }}" - # @jvonau recommends: 100sec is too much (keep 10sec default) - ignore_errors: True - #async: 10 - #poll: 2 - register: internet_access_test - -- name: "Set 'internet_available: True' if above download succeeded AND not disregard_network" - set_fact: - internet_available: True # Initialized to 'False' in 0-init/defaults/main.yml - when: not internet_access_test.failed and not disregard_network - -- name: Remove downloaded Internet test file /tmp/heart-beat.txt - file: - path: /tmp/heart-beat.txt - state: absent - - # so this works - name: Interface count shell: ls /sys/class/net | grep -v {{ virtual_network_devices }} | wc | awk '{print $1}' @@ -284,10 +249,6 @@ option: "{{ item.option }}" value: "{{ item.value | string }}" with_items: - - option: gw_active - value: "{{ gw_active }}" - - option: internet_available - value: "{{ internet_available }}" - option: has_ifcfg_gw value: "{{ has_ifcfg_gw }}" - option: prior_gateway_device From 4e717570e2bc723cc64a1b5e29b7362ff875cdbe Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 29 Jun 2022 22:25:57 -0500 Subject: [PATCH 2/6] vnstat - just use ansible in install mode --- roles/vnstat/tasks/install.yml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/roles/vnstat/tasks/install.yml b/roles/vnstat/tasks/install.yml index 94248c734..f76554ae9 100644 --- a/roles/vnstat/tasks/install.yml +++ b/roles/vnstat/tasks/install.yml @@ -1,19 +1,9 @@ # Similar code block in roles/network/tasks/detected_network.yml -- name: "If above ansible_default_ipv4.gateway is defined, set WAN candidate 'discovered_wan_iface: {{ ansible_default_ipv4.alias }}' -- using ansible_default_ipv4.alias" +- name: "Setting iiab_wan_iface to {{ ansible_default_ipv4.alias }}' -- using ansible_default_ipv4.alias if detected" set_fact: - discovered_wan_iface: "{{ ansible_default_ipv4.alias }}" + iiab_wan_iface: "{{ ansible_default_ipv4.alias }}" when: ansible_default_ipv4.gateway is defined -- name: "Verify gateway active: ping -c4 {{ ansible_default_ipv4.gateway }} -- using ansible_default_ipv4.gateway" - shell: ping -c4 "{{ ansible_default_ipv4.gateway }}" | grep icmp_seq=4 | wc -l - register: gw_active_test - when: discovered_wan_iface != "none" - -- name: "If gateway responded, set 'iiab_wan_iface: {{ discovered_wan_iface }}' -- using discovered_wan_iface" - set_fact: - iiab_wan_iface: "{{ discovered_wan_iface }}" - when: discovered_wan_iface != "none" and gw_active_test.stdout == "1" - - name: Install 'vnstat' package package: From ebae3606465da6c0dbec5ffd22500a0f98c8cf2e Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 29 Jun 2022 22:48:14 -0500 Subject: [PATCH 3/6] network - drop internet_available --- roles/network/defaults/main.yml | 6 ++---- roles/network/tasks/netplan.yml | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/roles/network/defaults/main.yml b/roles/network/defaults/main.yml index 6938f4a43..fd1fa4dcc 100644 --- a/roles/network/defaults/main.yml +++ b/roles/network/defaults/main.yml @@ -27,9 +27,6 @@ # hostapd_enabled: True # Above set in /opt/iiab/iiab/vars/default_vars.yml -# 2022-06-29: Legacy vars no longer used by roles/0-init -gw_active: False # 2021-07-30: Not used propgrammatically -discovered_wan_iface: none # 2021-07-30: Very broadly used! hostapd_wait: 10 host_wireless_n: False @@ -67,7 +64,8 @@ can_be_ap: False exclude_devices: none device_gw: none prior_gw_device: unset - +# 2022-06-29: Legacy vars no longer used by roles/0-init +discovered_wan_iface: none # 2021-07-30: Very broadly used! iiab_wan_iface: none iiab_lan_iface: none discovered_lan_iface: none diff --git a/roles/network/tasks/netplan.yml b/roles/network/tasks/netplan.yml index 799af001d..136b1df09 100644 --- a/roles/network/tasks/netplan.yml +++ b/roles/network/tasks/netplan.yml @@ -64,7 +64,7 @@ url: https://gitlab.com/craftyguy/networkd-dispatcher/-/raw/2.1/networkd-dispatcher dest: /usr/bin/networkd-dispatcher timeout: "{{ download_timeout }}" - when: internet_available and fix_dispatcher and ansible_distribution_release == "groovy" + when: iiab_stage|int < 9 and fix_dispatcher and ansible_distribution_release == "groovy" # 2021-08-29 context from @jvonau: Fix is 'Groovy' specific, 21.04 and later # should have the fix baked into a newer apt package installed by default. From 490f64a27ac1a90209fe93c2ba82cae30ae09098 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 29 Jun 2022 23:31:10 -0500 Subject: [PATCH 4/6] remove disregard_network from default_vars --- vars/default_vars.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/vars/default_vars.yml b/vars/default_vars.yml index 4e8b9f2bc..4440b9e58 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -97,9 +97,6 @@ js_menu_install: True # NETWORK role (/opt/iiab/iiab/roles/network). SEE ALSO: # https://github.com/iiab/iiab/blob/master/roles/network/defaults/main.yml -# The following variable may be useful in debugging: -disregard_network: False # Use cache, or error out if cache does not exist. - iiab_hostname: box iiab_domain: lan lan_ip: 172.18.96.1 From fb7aa6a9c3efa51fac0b9bc2004ac7e536f43da6 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 30 Jun 2022 01:31:56 -0500 Subject: [PATCH 5/6] Update roles/vnstat/tasks/install.yml Co-authored-by: A Holt --- roles/vnstat/tasks/install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/vnstat/tasks/install.yml b/roles/vnstat/tasks/install.yml index f76554ae9..84bec243c 100644 --- a/roles/vnstat/tasks/install.yml +++ b/roles/vnstat/tasks/install.yml @@ -1,5 +1,5 @@ # Similar code block in roles/network/tasks/detected_network.yml -- name: "Setting iiab_wan_iface to {{ ansible_default_ipv4.alias }}' -- using ansible_default_ipv4.alias if detected" +- name: "Setting iiab_wan_iface to '{{ ansible_default_ipv4.alias }}' -- using ansible_default_ipv4.alias if detected" set_fact: iiab_wan_iface: "{{ ansible_default_ipv4.alias }}" when: ansible_default_ipv4.gateway is defined From 46fad7936e3db81e05c8be9cc1d2874b9a9ca5ab Mon Sep 17 00:00:00 2001 From: root Date: Thu, 30 Jun 2022 10:29:08 -0400 Subject: [PATCH 6/6] netplan.yml: Mint networkd-dispatcher issue? groovy & internet_available removed --- roles/network/tasks/netplan.yml | 24 ++++++++++++++++-------- roles/www_options/tasks/main.yml | 2 +- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/roles/network/tasks/netplan.yml b/roles/network/tasks/netplan.yml index 136b1df09..43865d437 100644 --- a/roles/network/tasks/netplan.yml +++ b/roles/network/tasks/netplan.yml @@ -59,14 +59,22 @@ with_items: - "{{ netplan.stdout_lines }}" -- name: Replace networkd-dispatcher #2585 for "groovy" - get_url: - url: https://gitlab.com/craftyguy/networkd-dispatcher/-/raw/2.1/networkd-dispatcher - dest: /usr/bin/networkd-dispatcher - timeout: "{{ download_timeout }}" - when: iiab_stage|int < 9 and fix_dispatcher and ansible_distribution_release == "groovy" - # 2021-08-29 context from @jvonau: Fix is 'Groovy' specific, 21.04 and later - # should have the fix baked into a newer apt package installed by default. +# 2022-06-30: Ubuntu Groovy (20.10) is ancient history but this code might now +# help Linux Mint ? +# +# 2022-05-29: @jvonau wrote on #3106 "networkd-dispatcher has a traceback, +# I suspect the cause is the same as found #2645, need to confirm the package +# version installed with apt list networkd-dispatcher before suggesting the +# workaround be extended to LinuxMint" +# +# - name: Replace networkd-dispatcher #2585 for "groovy" +# get_url: +# url: https://gitlab.com/craftyguy/networkd-dispatcher/-/raw/2.1/networkd-dispatcher +# dest: /usr/bin/networkd-dispatcher +# timeout: "{{ download_timeout }}" +# when: iiab_stage|int < 9 and fix_dispatcher and ansible_distribution_release == "groovy" +# # 2021-08-29 context from @jvonau: Fix is 'Groovy' specific, 21.04 and later +# # should have the fix baked into a newer apt package installed by default. #- name: Supply netplan template # template: diff --git a/roles/www_options/tasks/main.yml b/roles/www_options/tasks/main.yml index 6c7362e49..445ee5e0e 100644 --- a/roles/www_options/tasks/main.yml +++ b/roles/www_options/tasks/main.yml @@ -154,7 +154,7 @@ when: not apache_allow_sudo -# internet_available var moved to roles/network/tasks/detected_network.yml +# 2022-06-30: internet_available var removed - name: 'Test for Internet access, using: {{ iiab_download_url }}/heart-beat.txt' get_url: url: "{{ iiab_download_url }}/heart-beat.txt"