mirror of
https://github.com/iiab/iiab.git
synced 2025-02-15 04:32:11 +00:00
Update detected_network.yml
This commit is contained in:
parent
535dca7fca
commit
2004e621e9
1 changed files with 63 additions and 62 deletions
|
@ -5,14 +5,14 @@
|
||||||
|
|
||||||
- name: Checking for old device gateway interface for device test
|
- name: Checking for old device gateway interface for device test
|
||||||
set_fact:
|
set_fact:
|
||||||
device_gw: "{{ prior_gw.stdout }}"
|
device_gw: "{{ prior_gw.stdout }}"
|
||||||
device_gw2: "{{ prior_gw.stdout }}"
|
device_gw2: "{{ prior_gw.stdout }}"
|
||||||
when: iiab_stage|int > 4 and prior_gw is defined and prior_gw.stdout != ""
|
when: iiab_stage|int > 4 and prior_gw is defined and prior_gw.stdout != ""
|
||||||
|
|
||||||
- name: Setting WAN if detected
|
- name: Setting WAN if detected
|
||||||
set_fact:
|
set_fact:
|
||||||
iiab_wan_iface: "{{ discovered_wan_iface }}"
|
iiab_wan_iface: "{{ discovered_wan_iface }}"
|
||||||
device_gw: "{{ discovered_wan_iface }}"
|
device_gw: "{{ discovered_wan_iface }}"
|
||||||
when: ansible_default_ipv4.gateway is defined
|
when: ansible_default_ipv4.gateway is defined
|
||||||
|
|
||||||
- name: Red Hat network detection (redhat)
|
- name: Red Hat network detection (redhat)
|
||||||
|
@ -57,11 +57,11 @@
|
||||||
|
|
||||||
- name: Set the discovered wireless, if found
|
- name: Set the discovered wireless, if found
|
||||||
set_fact:
|
set_fact:
|
||||||
wifi1: "{{ item|trim }}"
|
wifi1: "{{ item|trim }}"
|
||||||
discovered_wireless_iface: "{{ item|trim }}"
|
discovered_wireless_iface: "{{ item|trim }}"
|
||||||
when: item|trim != "" and item|trim != discovered_wan_iface
|
when: item|trim != "" and item|trim != discovered_wan_iface
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ wireless_list1.stdout_lines }}"
|
- "{{ wireless_list1.stdout_lines }}"
|
||||||
|
|
||||||
# WIRELESS -- Sigh... Not all drivers update /proc/net/wireless correctly
|
# WIRELESS -- Sigh... Not all drivers update /proc/net/wireless correctly
|
||||||
- name: Look for any wireless interfaces (take 2)
|
- name: Look for any wireless interfaces (take 2)
|
||||||
|
@ -73,11 +73,11 @@
|
||||||
# Last device is used
|
# Last device is used
|
||||||
- name: Set the discovered wireless, if found (take 2)
|
- name: Set the discovered wireless, if found (take 2)
|
||||||
set_fact:
|
set_fact:
|
||||||
wifi2: "{{ item|trim }}"
|
wifi2: "{{ item|trim }}"
|
||||||
discovered_wireless_iface: "{{ item|trim }}"
|
discovered_wireless_iface: "{{ item|trim }}"
|
||||||
when: wireless_list2.stdout is defined
|
when: wireless_list2.stdout is defined
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ wireless_list2.stdout_lines }}"
|
- "{{ wireless_list2.stdout_lines }}"
|
||||||
#item|trim != discovered_wan_iface
|
#item|trim != discovered_wan_iface
|
||||||
|
|
||||||
- name: Count WiFi ifaces
|
- name: Count WiFi ifaces
|
||||||
|
@ -87,19 +87,19 @@
|
||||||
# facts are apparently all stored as text, so do text comparisons from here on
|
# facts are apparently all stored as text, so do text comparisons from here on
|
||||||
- name: Remember number of WiFi devices
|
- name: Remember number of WiFi devices
|
||||||
set_fact:
|
set_fact:
|
||||||
num_wifi_interfaces: "{{ count_wifi_interfaces.stdout|int }}"
|
num_wifi_interfaces: "{{ count_wifi_interfaces.stdout|int }}"
|
||||||
|
|
||||||
# XO hack here ap_device would not be active therefore not set with
|
# 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
|
# wired as gw use ap_device to exclude eth0 from network calulations
|
||||||
|
|
||||||
- name: XO laptop override 2 WiFi on LAN
|
- name: XO laptop override 2 WiFi on LAN
|
||||||
set_fact:
|
set_fact:
|
||||||
ap_device: "eth0"
|
ap_device: "eth0"
|
||||||
when: iiab_wan_iface != "eth0" and discovered_wireless_iface != "none" and xo_model == "XO-1.5"
|
when: iiab_wan_iface != "eth0" and discovered_wireless_iface != "none" and xo_model == "XO-1.5"
|
||||||
|
|
||||||
- name: Exclude reserved WiFi adapter if defined - takes adapter name
|
- name: Exclude reserved WiFi adapter if defined - takes adapter name
|
||||||
set_fact:
|
set_fact:
|
||||||
ap_device: "{{ reserved_wifi }}"
|
ap_device: "{{ reserved_wifi }}"
|
||||||
when: reserved_wifi is defined and discovered_wireless_iface != iiab_wan_iface and num_wifi_interfaces >= "2"
|
when: reserved_wifi is defined and discovered_wireless_iface != iiab_wan_iface and num_wifi_interfaces >= "2"
|
||||||
|
|
||||||
- name: Count LAN ifaces
|
- name: Count LAN ifaces
|
||||||
|
@ -108,7 +108,7 @@
|
||||||
|
|
||||||
- name: Calculate number of LAN interfaces including WiFi
|
- name: Calculate number of LAN interfaces including WiFi
|
||||||
set_fact:
|
set_fact:
|
||||||
num_lan_interfaces: "{{ num_lan_interfaces_result.stdout|int }}"
|
num_lan_interfaces: "{{ num_lan_interfaces_result.stdout|int }}"
|
||||||
|
|
||||||
# LAN - pick non WAN's
|
# LAN - pick non WAN's
|
||||||
- name: Create list of LAN (non WAN) ifaces
|
- name: Create list of LAN (non WAN) ifaces
|
||||||
|
@ -128,19 +128,19 @@
|
||||||
# if there is more than one the last one wins
|
# if there is more than one the last one wins
|
||||||
- name: Set discovered_wired_iface if present
|
- name: Set discovered_wired_iface if present
|
||||||
set_fact:
|
set_fact:
|
||||||
discovered_wired_iface: "{{ item|trim }}"
|
discovered_wired_iface: "{{ item|trim }}"
|
||||||
when: lan_list_result.stdout_lines is defined and item|trim != discovered_wireless_iface
|
when: lan_list_result.stdout_lines is defined and item|trim != discovered_wireless_iface
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ lan_list_result.stdout_lines }}"
|
- "{{ lan_list_result.stdout_lines }}"
|
||||||
|
|
||||||
- name: Set iiab_wireless_lan_iface if present
|
- name: Set iiab_wireless_lan_iface if present
|
||||||
set_fact:
|
set_fact:
|
||||||
iiab_wireless_lan_iface: "{{ discovered_wireless_iface }}"
|
iiab_wireless_lan_iface: "{{ discovered_wireless_iface }}"
|
||||||
when: discovered_wireless_iface is defined and discovered_wireless_iface != "none" and discovered_wireless_iface != iiab_wan_iface
|
when: discovered_wireless_iface is defined and discovered_wireless_iface != "none" and discovered_wireless_iface != iiab_wan_iface
|
||||||
|
|
||||||
- name: Set iiab_wired_lan_iface if present
|
- name: Set iiab_wired_lan_iface if present
|
||||||
set_fact:
|
set_fact:
|
||||||
iiab_wired_lan_iface: "{{ discovered_wired_iface }}"
|
iiab_wired_lan_iface: "{{ discovered_wired_iface }}"
|
||||||
when: discovered_wired_iface is defined and discovered_wired_iface != "none" and discovered_wired_iface != iiab_wan_iface
|
when: discovered_wired_iface is defined and discovered_wired_iface != "none" and discovered_wired_iface != iiab_wan_iface
|
||||||
|
|
||||||
#unused
|
#unused
|
||||||
|
@ -150,33 +150,33 @@
|
||||||
# use value only if present
|
# use value only if present
|
||||||
- name: 2 or more devices on the LAN - use bridging
|
- name: 2 or more devices on the LAN - use bridging
|
||||||
set_fact:
|
set_fact:
|
||||||
iiab_lan_iface: br0
|
iiab_lan_iface: br0
|
||||||
when: num_lan_interfaces|int >= 2 and not is_rpi
|
when: num_lan_interfaces|int >= 2 and not is_rpi
|
||||||
|
|
||||||
- name: For Debian, always use bridging - except RPi
|
- name: For Debian, always use bridging - except RPi
|
||||||
set_fact:
|
set_fact:
|
||||||
iiab_lan_iface: br0
|
iiab_lan_iface: br0
|
||||||
when: num_lan_interfaces|int >= 1 and is_debuntu and not is_rpi
|
when: num_lan_interfaces|int >= 1 and is_debuntu and not is_rpi
|
||||||
|
|
||||||
- name: WiFi is on the LAN - use bridging - except RPi
|
- name: WiFi is on the LAN - use bridging - except RPi
|
||||||
set_fact:
|
set_fact:
|
||||||
iiab_lan_iface: br0
|
iiab_lan_iface: br0
|
||||||
when: iiab_wireless_lan_iface is defined and not nobridge is defined
|
when: iiab_wireless_lan_iface is defined and not nobridge is defined
|
||||||
|
|
||||||
- name: Setting wired LAN as only interface - RPi
|
- name: Setting wired LAN as only interface - RPi
|
||||||
set_fact:
|
set_fact:
|
||||||
iiab_lan_iface: "{{ iiab_wired_lan_iface }}"
|
iiab_lan_iface: "{{ iiab_wired_lan_iface }}"
|
||||||
when: iiab_wired_lan_iface is defined and nobridge is defined
|
when: iiab_wired_lan_iface is defined and nobridge is defined
|
||||||
|
|
||||||
- name: Setting wireless LAN as only interface - RPi
|
- name: Setting wireless LAN as only interface - RPi
|
||||||
set_fact:
|
set_fact:
|
||||||
iiab_lan_iface: "{{ iiab_wireless_lan_iface }}"
|
iiab_lan_iface: "{{ iiab_wireless_lan_iface }}"
|
||||||
when: iiab_wireless_lan_iface is defined and nobridge is defined
|
when: iiab_wireless_lan_iface is defined and nobridge is defined
|
||||||
|
|
||||||
- name: In VM disable LAN - needs local_vars entry to activate
|
- name: In VM disable LAN - needs local_vars entry to activate
|
||||||
set_fact:
|
set_fact:
|
||||||
iiab_lan_iface: none
|
iiab_lan_iface: none
|
||||||
no_net_restart: True
|
no_net_restart: True
|
||||||
when: is_VM is defined
|
when: is_VM is defined
|
||||||
|
|
||||||
# OK try old gw this is a best guess based on what's in
|
# OK try old gw this is a best guess based on what's in
|
||||||
|
@ -188,41 +188,42 @@
|
||||||
gui_wan_iface: "{{ device_gw }}"
|
gui_wan_iface: "{{ device_gw }}"
|
||||||
when: user_wan_iface == "auto" and device_gw != "none" and discovered_wan_iface == "none"
|
when: user_wan_iface == "auto" and device_gw != "none" and discovered_wan_iface == "none"
|
||||||
|
|
||||||
- name: Add location section to config file
|
- name: Add 'detected_network' variable values to /etc/iiab/iiab.ini
|
||||||
ini_file: dest='{{ iiab_config_file }}'
|
ini_file:
|
||||||
section=detected_network
|
dest: "{{ iiab_config_file }}"
|
||||||
option='{{ item.option }}'
|
section: detected_network
|
||||||
value='{{ item.value }}'
|
option: "{{ item.option }}"
|
||||||
|
value: "{{ item.value }}"
|
||||||
with_items:
|
with_items:
|
||||||
- option: 'has_ifcfg_gw'
|
- option: has_ifcfg_gw
|
||||||
value: '{{ has_ifcfg_gw }}'
|
value: "{{ has_ifcfg_gw }}"
|
||||||
- option: 'prior_gateway_(device_gw2)'
|
- option: prior_gateway_(device_gw2)
|
||||||
value: '{{ device_gw2 }}'
|
value: "{{ device_gw2 }}"
|
||||||
- option: 'dhcpcd_result'
|
- option: dhcpcd_result
|
||||||
value: '{{ dhcpcd_result }}'
|
value: "{{ dhcpcd_result }}"
|
||||||
- option: 'network_manager_active'
|
- option: network_manager_active
|
||||||
value: '{{ network_manager_active }}'
|
value: "{{ network_manager_active }}"
|
||||||
- option: 'systemd_networkd_active'
|
- option: systemd_networkd_active
|
||||||
value: '{{ systemd_networkd_active }}'
|
value: "{{ systemd_networkd_active }}"
|
||||||
- option: 'wan_in_interfaces'
|
- option: wan_in_interfaces
|
||||||
value: '{{ wan_in_interfaces }}'
|
value: "{{ wan_in_interfaces }}"
|
||||||
- option: 'wireless_list_1(wifi1)'
|
- option: wireless_list_1(wifi1)
|
||||||
value: '{{ wifi1 }}'
|
value: "{{ wifi1 }}"
|
||||||
- option: 'wireless_list_2(wifi2)'
|
- option: wireless_list_2(wifi2)
|
||||||
value: '{{ wifi2 }}'
|
value: "{{ wifi2 }}"
|
||||||
- option: 'num_wifi_interfaces'
|
- option: num_wifi_interfaces
|
||||||
value: '{{ num_wifi_interfaces }}'
|
value: "{{ num_wifi_interfaces }}"
|
||||||
- option: 'discovered_wireless_iface'
|
- option: discovered_wireless_iface
|
||||||
value: '{{ discovered_wireless_iface }}'
|
value: "{{ discovered_wireless_iface }}"
|
||||||
- option: 'discovered_wired_iface'
|
- option: discovered_wired_iface
|
||||||
value: '{{ discovered_wired_iface }}'
|
value: "{{ discovered_wired_iface }}"
|
||||||
# - option: 'iiab_wireless_lan_iface'
|
# - option: 'iiab_wireless_lan_iface
|
||||||
# value: '{{ iiab_wireless_lan_iface }}'
|
# value: '{{ iiab_wireless_lan_iface }}"
|
||||||
- option: 'num_lan_interfaces'
|
- option: num_lan_interfaces
|
||||||
value: '{{ num_lan_interfaces }}'
|
value: "{{ num_lan_interfaces }}"
|
||||||
- option: 'gui_static_wan'
|
- option: gui_static_wan
|
||||||
value: '{{ gui_static_wan }}'
|
value: "{{ gui_static_wan }}"
|
||||||
- option: 'iiab_lan_iface'
|
- option: iiab_lan_iface
|
||||||
value: '{{ iiab_lan_iface }}'
|
value: "{{ iiab_lan_iface }}"
|
||||||
- option: 'iiab_wan_iface'
|
- option: iiab_wan_iface
|
||||||
value: '{{ iiab_wan_iface }}'
|
value: "{{ iiab_wan_iface }}"
|
||||||
|
|
Loading…
Reference in a new issue