1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

running - double check after rebase

This commit is contained in:
Jerry Vonau 2017-11-01 08:45:55 -04:00
parent 37b8e3fdb6
commit 8e37472fbf
5 changed files with 61 additions and 35 deletions

View file

@ -8,18 +8,23 @@ gui_static_wan: False
# Set defaults for discovery process as strings
wifi1: "not found-1"
wifi2: "not found-2"
discovered_lan_iface: "none"
discovered_wireless_iface: "none"
#Redhat
iiab_lan_iface: "none"
iiab_wan_iface: "none"
iiab_wireless_lan_iface: "none"
ap_device: "none"
device_gw: "none"
device_gw2: ""
iiab_wan_iface: "none"
iiab_lan_iface: "none"
discovered_lan_iface: "none"
discovered_wired_iface: "none"
discovered_wireless_iface: "none"
iiab_wired_lan_iface: "none"
iiab_wireless_lan_iface: "none"
#Redhat
has_WAN: False
has_ifcfg_gw: "none"
has_wifi_gw: "none"
ap_device: "none"
#Debian
dhcpcd_result: ""
wan_in_interfaces: False

View file

@ -32,7 +32,8 @@
- name: Supply dhcpcd.conf
template: dest=/etc/dhcpcd.conf
src=network/dhcpcd.conf.j2
when: dhcpcd_result == "enabled" and (iiab_lan_iface == "br0" or wan_ip != "dhcp")
when: dhcpcd_result == "enabled"
#and (iiab_lan_iface == "br0" or wan_ip != "dhcp")
- name: Copy the bridge script
template: dest=/etc/network/interfaces.d/iiab
@ -42,7 +43,7 @@
- name: If this was a change, things need to shift
service: name=hostapd state=stopped
when: interface.changed
# when: interface.changed
- name: bind may be affected
service: name={{ dns_service }} state=stopped
@ -63,7 +64,7 @@
# now pick up denyinterfaces
- name: restart dhcpcd
service: name=dhcpcd state=restarted
when: interface.changed and dhcpcd_result == "enabled"
when: dhcpcd_result == "enabled"
- name: restart the networking service
service: name=networking state=restarted

View file

@ -73,6 +73,7 @@
shell: "ls -la /sys/class/net/*/phy80211 | awk -F / '{print $5}' | wc -l"
register: count_wifi_interfaces
# facts are apparently all stored as text, so do text comparisons from here on
- name: Remember number of WiFi devices
set_fact:
num_wifi_interfaces: "{{ count_wifi_interfaces.stdout|int }}"
@ -98,22 +99,12 @@
ignore_errors: True
changed_when: false
# Select an adapter that is not WAN and not wireless
# if there is more than one the last one wins
- name: Set IIAB discovered_lan_iface fact
set_fact:
discovered_lan_iface: "{{ item|trim }}"
when: item|trim != discovered_wireless_iface and item|trim != discovered_wan_iface
with_items:
- "{{ lan_list_result.stdout_lines }}"
- 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
# facts are apparently all stored as text, so do text comparisons from here on
- name: Calulate number of LAN interfaces including WiFi
set_fact:
num_lan_interfaces: "{{ num_lan_interfaces_result.stdout|int }}"
@ -126,20 +117,39 @@
# num_lan_interfaces: "1"
# when: iiab_lan_enabled and iiab_wan_enabled and num_lan_interfaces == "2" and discovered_wireless_iface != "none" and iiab_wan_iface == "none"
- name: Set variable discovered_wireless_iface if present
# if there is more than one the last one wins
# Select an adapter that is not WAN and not wireless
- name: Set discovered_wired_iface fact if present
set_fact:
discovered_wired_iface: "{{ item|trim }}"
when: item|trim != discovered_wireless_iface and item|trim != discovered_wan_iface
with_items:
- "{{ lan_list_result.stdout_lines }}"
- name: Set discovered_wireless_lan_iface fact if present
set_fact:
iiab_wireless_lan_iface: "{{ discovered_wireless_iface }}"
when: 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 variable discovered_wired_lan_iface if present
set_fact:
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
#unused
#- name: Get a list of ifcfg files to delete
# moved to detected_redhat
# use value only if present
- name: Setting detected LAN
- name: Setting wired LAN as only interface
set_fact:
iiab_lan_iface: "{{ discovered_lan_iface }}"
when: 'discovered_lan_iface != "none" and num_lan_interfaces == "1"'
iiab_lan_iface: "{{ iiab_wired_lan_iface }}"
when: iiab_wired_lan_iface is defined and num_lan_interfaces == "1"
- name: Setting wireless LAN as only interface
set_fact:
iiab_lan_iface: "{{ iiab_wireless_lan_iface }}"
when: iiab_wireless_lan_iface is defined and num_lan_interfaces == "1"
# big hammer for now
#- name: For Debian, always use bridging
@ -159,7 +169,7 @@
- name: in VM disable bridging
set_fact:
iiab_lan_iface: none
iiab_lan_iface: none
when: is_VM is defined
# OK try old gw this is a best guess based on what's in
@ -195,7 +205,11 @@
value: '{{ iiab_wireless_lan_iface }}'
- option: 'num_lan_interfaces'
value: '{{ num_lan_interfaces }}'
- option: 'discovered_lan_iface'
value: '{{ discovered_lan_iface }}'
- option: 'discovered_wired_iface'
value: '{{ discovered_wired_iface }}'
- option: 'gui_static_wan'
value: '{{ gui_static_wan }}'
- option: 'dhcpcd_result'
value: '{{ dhcpcd_result }}'
- option: 'iiab_lan'
value: '{{ iiab_lan_iface }}'

View file

@ -1,3 +1,6 @@
- include_vars: roles/network/defaults/main.yml
- include_tasks: detected_network.yml
when: not installing
tags:
@ -62,12 +65,13 @@
- include_tasks: debian.yml
tags:
- network
when: is_debuntu and not is_rpi and not installing
when: is_debuntu
#and not is_rpi and not installing
- include_tasks: rpi_debian.yml
tags:
- network
when: is_debuntu and is_rpi and not installing
#- include_tasks: rpi_debian.yml
# tags:
# - network
# when: is_debuntu and is_rpi and not installing
- name: Record iiab_wan_device
lineinfile: dest=/etc/iiab/iiab.env

View file

@ -40,9 +40,11 @@ slaac private
# supplied by IIAB
denyinterfaces {% if gui_static_wan == true %} {{ iiab_wan_iface }} {% endif %} {% if iiab_wireless_lan_iface != "none" %} {{ iiab_wireless_lan_iface }} {% endif %} {% if discovered_lan_iface != "none" %} {{ discovered_lan_iface }} {% endif %}
#{% if gui_static_wan == true %}
#denyinterfaces {{ iiab_wan_iface }}
#{% endif %}
{% if dhcpcd_result == "enabled" and iiab_lan_iface == "br0" %}
{% if dhcpcd_result == "enabled" and iiab_lan_iface != "none" %}
interface {{ iiab_lan_iface }}
static ip_address={{ lan_ip }}/19
static routers={{ lan_ip }}