1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-15 04:32:11 +00:00

don't run lan_list_result when 'Count LAN ifaces' is zero to quite

down noisy log when detecting single interface
This commit is contained in:
Jerry Vonau 2017-11-09 00:24:29 -06:00
parent 4079043456
commit 7b5de542cf

View file

@ -92,23 +92,20 @@
ap_device: "{{ blacklist_wifi }}"
when: blacklist_wifi is defined and discovered_wireless_iface != iiab_wan_iface and num_wifi_interfaces >= "2"
# LAN - pick non WAN's
- name: Create list of LAN (non WAN) ifaces
shell: ls /sys/class/net | grep -v -e wwlan -e ppp -e lo -e br0 -e tun -e {{ device_gw }} -e {{ ap_device }}
register: lan_list_result
ignore_errors: True
changed_when: false
- name: Count LAN ifaces
shell: ls /sys/class/net | grep -v -e wwlan -e ppp -e lo -e br0 -e tun -e {{ device_gw }} -e {{ ap_device }} | wc -l
register: num_lan_interfaces_result
ignore_errors: True
changed_when: false
- name: Calculate number of LAN interfaces including WiFi
set_fact:
num_lan_interfaces: "{{ num_lan_interfaces_result.stdout|int }}"
# LAN - pick non WAN's
- name: Create list of LAN (non WAN) ifaces
shell: ls /sys/class/net | grep -v -e wwlan -e ppp -e lo -e br0 -e tun -e {{ device_gw }} -e {{ ap_device }}
when: num_lan_interfaces != 0
register: lan_list_result
# If 2 interfaces found in gateway mode, with one wifi, declare other to be wan
#- name: In gateway mode with one wifi adapter, the other is WAN
# set_fact:
@ -122,7 +119,7 @@
- name: Set discovered_wired_iface fact if present
set_fact:
discovered_wired_iface: "{{ item|trim }}"
when: item|trim != discovered_wireless_iface
when: item|trim != discovered_wireless_iface and lan_list_result is defined
with_items:
- "{{ lan_list_result.stdout_lines }}"