Skip to content

Commit

Permalink
2515 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jvonau committed Sep 15, 2020
1 parent 01d418e commit 797aee3
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions roles/network/tasks/detected_network.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,21 +101,32 @@
set_fact:
num_wifi_interfaces: "{{ count_wifi_interfaces.stdout|int }}"

- name: Detect wifi gateway active
shell: ip r | grep default | grep {{ discovered_wireless_iface }} | wc -l
register: wifi_gateway_found
when: discovered_wireless_iface != "none"

- name: Set has_wifi_gateway for {{ discovered_wireless_iface }} if gateway is detected
set_fact:
exclude_device: "-e {{ discovered_wireless_iface }}"
has_wifi_gateway: True
when: discovered_wireless_iface != "none" and (wifi_gateway_found.stdout|int > 0)

# XO hack here ap_device would not be active therefore not set with
# wired as gw use ap_device to exclude eth0 from network calulations

- name: XO laptop override 2 WiFi on LAN
set_fact:
exclude_device: "eth0"
when: iiab_wan_iface != "eth0" and discovered_wireless_iface != "none" and xo_model == "XO-1.5"
#- name: XO laptop override 2 WiFi on LAN
# set_fact:
# exclude_device: "eth0"
# when: iiab_wan_iface != "eth0" and discovered_wireless_iface != "none" and xo_model == "XO-1.5"

- name: Exclude reserved Network Adapter if defined - takes adapter name
set_fact:
exclude_device: "{{ reserved_device }}"
exclude_device: "-e {{ reserved_device }} {{ exclude_device }}"
when: reserved_device is defined

- name: Count LAN ifaces
shell: ls /sys/class/net | grep -v {{ virtual_network_devices }} -e wwlan -e ppp -e {{ device_gw }} -e {{ exclude_device }} | wc -l
shell: ls /sys/class/net | grep -v {{ virtual_network_devices }} -e wwlan -e ppp -e {{ device_gw }} {{ exclude_device }} | wc -l
register: num_lan_interfaces_result

- name: Calculate number of LAN interfaces including WiFi
Expand All @@ -124,7 +135,7 @@

# LAN - pick non WAN's
- name: Create list of LAN (non WAN) ifaces
shell: ls /sys/class/net | grep -v {{ virtual_network_devices }} -e wwlan -e ppp -e {{ device_gw }} -e {{ exclude_device }}
shell: ls /sys/class/net | grep -v {{ virtual_network_devices }} -e wwlan -e ppp -e {{ device_gw }} {{ exclude_device }}
when: num_lan_interfaces != "0"
register: lan_list_result

Expand All @@ -145,16 +156,6 @@
with_items:
- "{{ lan_list_result.stdout_lines }}"

- name: Detect wifi gateway active
shell: ip r | grep default | grep {{ discovered_wireless_iface }} | wc -l
when: discovered_wireless_iface != "none"
register: wifi_gateway_found

- name: Set has_wifi_gateway for {{ discovered_wireless_iface }} if gateway is detected
set_fact:
has_wifi_gateway: True
when: wifi_gateway_found is defined and (wifi_gateway_found.stdout|int > 0)

- name: Set iiab_wireless_lan_iface to {{ discovered_wireless_iface }} if not none
set_fact:
iiab_wireless_lan_iface: "{{ discovered_wireless_iface }}"
Expand Down

0 comments on commit 797aee3

Please sign in to comment.