1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-14 20:22:08 +00:00

network - reduce is_rpi or move to is_raspbian

This commit is contained in:
Jerry Vonau 2020-03-04 17:00:01 -06:00
parent 9d9997584e
commit 845d88cf41
7 changed files with 17 additions and 46 deletions

View file

@ -135,18 +135,7 @@
- name: LAN configured - 'Gateway' mode - name: LAN configured - 'Gateway' mode
set_fact: set_fact:
iiab_network_mode: "Gateway" iiab_network_mode: "Gateway"
when: is_rpi or (not (iiab_lan_iface == "none") and not (iiab_wan_iface == "none")) when: (not (iiab_lan_iface == "none") and not (iiab_wan_iface == "none"))
- name: Force iiab_lan_iface if is_rpi
set_fact:
iiab_lan_iface: "br0"
iiab_wireless_lan_iface: "wlan0"
when: is_rpi | bool
- name: Enable hostapd if discovered_wireless_iface is not WAN
set_fact:
hostapd_enabled: True
when: is_rpi and not (iiab_wan_iface == discovered_wireless_iface)
# override with user_lan_iface setting if no longer in auto # override with user_lan_iface setting if no longer in auto
- name: Setting user LAN fact - name: Setting user LAN fact

View file

@ -41,13 +41,13 @@
template: template:
dest: /etc/network/interfaces.d/iiab dest: /etc/network/interfaces.d/iiab
src: network/systemd.j2 src: network/systemd.j2
when: not is_rpi and (iiab_lan_iface == "br0" or wan_ip != "dhcp" or gui_static_wan_ip == "undefined") when: not is_raspbian (iiab_lan_iface == "br0" or wan_ip != "dhcp" or gui_static_wan_ip == "undefined")
- name: Copy the bridge script for RPi - name: Copy the bridge script for RPi
template: template:
dest: /etc/network/interfaces.d/iiab dest: /etc/network/interfaces.d/iiab
src: network/rpi.j2 src: network/rpi.j2
when: is_rpi and iiab_lan_iface == "br0" when: is_raspbian and iiab_lan_iface == "br0"
- name: Workaround auto issue - ifupdown compatibility mode (debian-9+) - name: Workaround auto issue - ifupdown compatibility mode (debian-9+)
template: template:
@ -62,24 +62,7 @@
regexp: "{{ iiab_wan_iface }}" regexp: "{{ iiab_wan_iface }}"
when: wan_ip != "dhcp" and iiab_wan_iface != "none" and is_debian and not is_debian_8 when: wan_ip != "dhcp" and iiab_wan_iface != "none" and is_debian and not is_debian_8
- name: BIND may be affected - include_tasks: down-debian.yml
service:
name: "{{ dns_service }}"
state: stopped
when: named_install and dnsmasq_enabled
# dhcpd_server release the interface
- name: dhcpd_server may be affected - stopping dhcpd
service:
name: dhcpd
state: stopped
when: dhcpd_install | bool
- name: dhcpd_server may be affected - stopping dnsmasq
service:
name: dnsmasq
state: stopped
when: dnsmasq_install | bool
- name: Reload systemd - name: Reload systemd
systemd: systemd:

View file

@ -141,7 +141,7 @@
- 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 and not is_rpi when: discovered_wired_iface is defined and discovered_wired_iface != "none" and discovered_wired_iface != iiab_wan_iface and not is_raspbian
#unused #unused
#- name: Get a list of ifcfg files to delete #- name: Get a list of ifcfg files to delete
@ -151,14 +151,14 @@
- 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
- name: For Debian, always use bridging - except RPi - name: For Debian, always use bridging
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
- name: WiFi is on the LAN - use bridging - except RPi - name: WiFi is on the LAN - use bridging
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

View file

@ -98,7 +98,6 @@
when: dnsmasq_install and dnsmasq_enabled and nd_dir.stat.exists and nd_dir.stat.isdir and (iiab_network_mode != "Appliance") when: dnsmasq_install and dnsmasq_enabled and nd_dir.stat.exists and nd_dir.stat.isdir and (iiab_network_mode != "Appliance")
#when: dnsmasq_install and dnsmasq_enabled and nd_enabled is defined and nd_enabled.stdout == "enabled" and nd_dir.stat.exists and nd_dir.stat.isdir and (iiab_network_mode != "Appliance") #when: dnsmasq_install and dnsmasq_enabled and nd_enabled is defined and nd_enabled.stdout == "enabled" and nd_dir.stat.exists and nd_dir.stat.isdir and (iiab_network_mode != "Appliance")
#when: dnsmasq_install and dnsmasq_enabled and systemd_out.status.UnitFileState == "enabled" and networkd_dir.stat.exists and networkd_dir.stat.isdir and (iiab_network_mode != "Appliance") #when: dnsmasq_install and dnsmasq_enabled and systemd_out.status.UnitFileState == "enabled" and networkd_dir.stat.exists and networkd_dir.stat.isdir and (iiab_network_mode != "Appliance")
#when: dnsmasq_enabled and dnsmasq_install and (iiab_network_mode != "Appliance") and (not is_rpi) and (not is_ubuntu_16)
- name: Remove /etc/dnsmasq.d/iiab.conf, when not dnsmasq_enabled or is Appliance - name: Remove /etc/dnsmasq.d/iiab.conf, when not dnsmasq_enabled or is Appliance
file: file:

View file

@ -37,7 +37,7 @@
owner: root owner: root
group: root group: root
mode: 0755 mode: 0755
when: is_rpi | bool when: is_raspbian | bool
- name: Create /usr/bin/iiab-hotspot-off from template - name: Create /usr/bin/iiab-hotspot-off from template
template: template:
@ -46,7 +46,7 @@
owner: root owner: root
group: root group: root
mode: 0755 mode: 0755
when: is_rpi | bool when: is_raspbian | bool
- name: Disable the Access Point 'hostapd' service - name: Disable the Access Point 'hostapd' service
systemd: systemd:

View file

@ -22,7 +22,7 @@
# iiab_wan_iface: "{{ discovered_wired_iface }}" # iiab_wan_iface: "{{ discovered_wired_iface }}"
# iiab_wireless_lan_iface: "{{ discovered_wireless_iface }}" # iiab_wireless_lan_iface: "{{ discovered_wireless_iface }}"
# iiab_wired_lan_iface: "" # iiab_wired_lan_iface: ""
# when: is_rpi and discovered_wireless_iface is defined and discovered_wireless_iface == iiab_wan_iface and reboot_to_AP # when: is_raspbian and discovered_wireless_iface is defined and discovered_wireless_iface == iiab_wan_iface and reboot_to_AP
- include_tasks: computed_network.yml - include_tasks: computed_network.yml
when: not installing #REMOVE THIS LINE IF installing IS ALWAYS false AS SET IN roles/0-init/defaults/main.yml when: not installing #REMOVE THIS LINE IF installing IS ALWAYS false AS SET IN roles/0-init/defaults/main.yml
@ -33,7 +33,7 @@
# set_fact: # set_fact:
# no_net_restart: True # no_net_restart: True
# hostapd_enabled: False # hostapd_enabled: False
# when: is_rpi and discovered_wireless_iface is defined and discovered_wired_iface != iiab_wan_iface # when: is_raspbian and discovered_wireless_iface is defined and discovered_wired_iface != iiab_wan_iface
##### Start static ip address info for first run ##### ##### Start static ip address info for first run #####
#- include_tasks: static.yml #- include_tasks: static.yml
@ -91,12 +91,12 @@
- name: RPi's have dhcpcd in use - name: RPi's have dhcpcd in use
include_tasks: rpi_debian.yml include_tasks: rpi_debian.yml
when: is_debuntu and is_rpi when: is_raspbian
#and not installing #and not installing
- name: Not RPi, Not NetworkManager, Not systemd-networkd in use - name: Not RPi, Not NetworkManager, Not systemd-networkd in use
include_tasks: debian.yml include_tasks: debian.yml
when: (not is_rpi and not network_manager_active and not systemd_networkd_active and is_debuntu) or is_ubuntu_16 when: (not is_raspbian and not network_manager_active and not systemd_networkd_active and is_debuntu) or is_ubuntu_16
#and not installing #and not installing
#### end network layout #### end network layout

View file

@ -42,9 +42,9 @@ slaac private
# Always (try) to run DHCP client on RPi's Ethernet port, for in-field # Always (try) to run DHCP client on RPi's Ethernet port, for in-field
# "cablemodems" used by many non-technical operators, who want Zero-Hassle # "cablemodems" used by many non-technical operators, who want Zero-Hassle
# Updates. This means AVOIDING "denyinterfaces eth0" below: # Updates. This means AVOIDING "denyinterfaces eth0" below:
{% if is_rpi and hostapd_enabled %} {% if is_raspbian and hostapd_enabled %}
denyinterfaces{% if discovered_wireless_iface != "none" %} {{ discovered_wireless_iface }}{% endif %} denyinterfaces{% if discovered_wireless_iface != "none" %} {{ discovered_wireless_iface }}{% endif %}
{% elif is_rpi %} {% elif is_raspbian %}
#denyinterfaces{% if discovered_wireless_iface != "none" %} {{ discovered_wireless_iface }}{% endif %} #denyinterfaces{% if discovered_wireless_iface != "none" %} {{ discovered_wireless_iface }}{% endif %}
{% else %} {% else %}
denyinterfaces{% if iiab_wireless_lan_iface is defined %} {{ iiab_wireless_lan_iface }}{% endif %}{% if iiab_wired_lan_iface is defined %} {{ iiab_wired_lan_iface }}{% endif %} denyinterfaces{% if iiab_wireless_lan_iface is defined %} {{ iiab_wireless_lan_iface }}{% endif %}{% if iiab_wired_lan_iface is defined %} {{ iiab_wired_lan_iface }}{% endif %}