mirror of
https://github.com/iiab/iiab.git
synced 2025-02-12 19:22:24 +00:00
Merge pull request #3302 from holta/wifi_net2
Allow for network role to be fully optional, building on PR #3173
This commit is contained in:
commit
767ee485ca
12 changed files with 139 additions and 132 deletions
|
@ -1,3 +1,8 @@
|
|||
- name: "Set 'iiab_fqdn: {{ iiab_hostname }}.{{ iiab_domain }}'"
|
||||
set_fact:
|
||||
iiab_fqdn: "{{ iiab_hostname }}.{{ iiab_domain }}"
|
||||
FQDN_changed: False
|
||||
|
||||
- name: Does /etc/cloud/cloud.cfg exist e.g. is this Ubuntu Server 18+ ?
|
||||
stat:
|
||||
path: /etc/cloud/cloud.cfg
|
||||
|
@ -17,16 +22,10 @@
|
|||
# 2021-08-31: Periods in /etc/hostname fail with some WiFi routers (#2904)
|
||||
# command: hostnamectl set-hostname "{{ iiab_hostname }}.{{ iiab_domain }}"
|
||||
|
||||
#- name: Install /etc/sysconfig/network from template (redhat)
|
||||
# template:
|
||||
# src: roles/network/templates/network/sysconfig.network.j2
|
||||
# dest: /etc/sysconfig/network
|
||||
# owner: root
|
||||
# group: root
|
||||
# mode: 0644
|
||||
# when: is_redhat
|
||||
|
||||
# roles/network/tasks/hosts.yml [no longer in use] ALSO did this:
|
||||
# 2022-07-11: Should the first entry match just hostname and domain move to
|
||||
# after localhost? See PR's #1 & #8 -- with discussion on #3302 -- and also:
|
||||
# 1. /etc/hosts -- #1815 solved by PR #1847
|
||||
# 2. /etc/hostname -- #2904 solved by PR #2973
|
||||
- name: 'Put FQDN & hostnames in /etc/hosts: "127.0.0.1 {{ iiab_hostname }}.{{ iiab_domain }} localhost.localdomain localhost {{ iiab_hostname }} box box.lan"'
|
||||
lineinfile:
|
||||
path: /etc/hosts
|
||||
|
@ -36,6 +35,14 @@
|
|||
#group: root
|
||||
#mode: 0644
|
||||
|
||||
# 2021-07-30: FQDN_changed isn't used as in the past -- its remaining use is
|
||||
# for {named, dhcpd, squid} in roles/network/tasks/main.yml -- possibly it
|
||||
# should be reconsidered? See PR #2876: roles/network might become optional?
|
||||
- name: "Also set 'FQDN_changed: True' -- if iiab_fqdn != ansible_fqdn ({{ ansible_fqdn }})"
|
||||
set_fact:
|
||||
FQDN_changed: True
|
||||
when: iiab_fqdn != ansible_fqdn
|
||||
|
||||
#- name: Re-configuring httpd - not initial install
|
||||
# include_tasks: roles/httpd/tasks/main.yml
|
||||
# when: iiab_stage|int > 3
|
||||
|
|
|
@ -54,9 +54,8 @@
|
|||
- name: "Time Zone / TZ: Set symlink /etc/localtime to UTC if it doesn't exist?"
|
||||
include_tasks: tz.yml
|
||||
|
||||
- name: Set new hostname/domain (hostname.yml) if nec
|
||||
include_tasks: network.yml
|
||||
|
||||
- name: Set hostname / domain (etc) in various places
|
||||
include_tasks: hostname.yml
|
||||
|
||||
- name: Add 'runtime' variable values to {{ iiab_ini_file }}
|
||||
ini_file:
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
- name: "Set 'iiab_fqdn: {{ iiab_hostname }}.{{ iiab_domain }}'"
|
||||
set_fact:
|
||||
iiab_fqdn: "{{ iiab_hostname }}.{{ iiab_domain }}"
|
||||
FQDN_changed: False
|
||||
|
||||
- name: Set hostname / domain (etc) in various places -- if iiab_fqdn != ansible_fqdn ({{ ansible_fqdn }})
|
||||
include_tasks: hostname.yml
|
||||
when: iiab_fqdn != ansible_fqdn
|
||||
|
||||
# 2021-07-30: FQDN_changed isn't used as in the past -- its remaining use is
|
||||
# for {named, dhcpd, squid} in roles/network/tasks/main.yml -- possibly it
|
||||
# should be reconsidered? See PR #2876: roles/network might become optional?
|
||||
- name: "Also set 'FQDN_changed: True' -- if iiab_fqdn != ansible_fqdn ({{ ansible_fqdn }})"
|
||||
set_fact:
|
||||
FQDN_changed: True
|
||||
when: iiab_fqdn != ansible_fqdn
|
||||
|
||||
|
||||
# 2021-08-17: (1) iiab-gen-iptables works better if gui_port is set directly in
|
||||
# default_vars.yml and/or local_vars.yml (2) Admin Console's iiab-admin.yml
|
||||
# and js-menu.yml set 'adm_cons_force_ssl: False'
|
||||
|
||||
# - name: "Set 'gui_port: 80' for Admin Console if not adm_cons_force_ssl"
|
||||
# set_fact:
|
||||
# gui_port: 80
|
||||
# when: not adm_cons_force_ssl
|
||||
|
||||
# - name: "Set 'gui_port: 443' for Admin Console if adm_cons_force_ssl"
|
||||
# set_fact:
|
||||
# gui_port: 443
|
||||
# when: adm_cons_force_ssl
|
|
@ -63,7 +63,7 @@
|
|||
#
|
||||
# 2020-11-04: Fix validation of 5 [now 4] core dependencies, for ./runrole etc
|
||||
|
||||
- name: Set vars_checklist for 44 + 44 + 40 vars ("XYZ_install" + "XYZ_enabled" + "XYZ_installed") to be checked
|
||||
- name: Set vars_checklist for 45 + 45 + 41 vars ("XYZ_install" + "XYZ_enabled" + "XYZ_installed") to be checked
|
||||
set_fact:
|
||||
vars_checklist:
|
||||
- hostapd
|
||||
|
@ -122,6 +122,7 @@
|
|||
- calibreweb
|
||||
- calibre
|
||||
- pbx
|
||||
- network
|
||||
|
||||
- name: Assert that {{ vars_checklist | length }} "XYZ_install" vars are all... defined
|
||||
assert:
|
||||
|
|
|
@ -29,9 +29,9 @@
|
|||
dest: /usr/bin/
|
||||
mode: '0755'
|
||||
|
||||
- name: Install dnsmasq -- configure LATER in 'network', after Stage 9
|
||||
include_tasks: roles/network/tasks/dnsmasq.yml
|
||||
#when: dnsmasq_install # Flag might be used in future?
|
||||
- name: Install ~12 network/wifi/related packages + Squid if necessary + configure /etc/sysctl.conf -- full configuration LATER in 'network', after Stage 9
|
||||
include_tasks: roles/network/tasks/install.yml
|
||||
when: network_install and network_installed is undefined
|
||||
|
||||
- include_tasks: uuid.yml
|
||||
- include_tasks: ubermix.yml
|
||||
|
|
|
@ -8,8 +8,14 @@
|
|||
|
||||
- include_tasks: packages.yml
|
||||
|
||||
- name: Install network packages (including many WiFi tools, and also iptables-persistent for firewall)
|
||||
include_tasks: network.yml
|
||||
- name: "Use 'sysctl' to set 'kernel.core_uses_pid: 1' in /etc/sysctl.conf"
|
||||
sysctl: # Places these settings in /etc/sysctl.conf, to survive reboot
|
||||
name: "{{ item.name }}"
|
||||
value: "{{ item.value }}"
|
||||
with_items:
|
||||
#- { name: 'kernel.sysrq', value: '1' } # OS values differ, Ok?
|
||||
- { name: 'kernel.core_uses_pid', value: '1' }
|
||||
#- { name: 'kernel.shmmax', value: '268435456' } # OS values differ, Ok?
|
||||
|
||||
- include_tasks: iiab-startup.yml
|
||||
|
||||
|
|
|
@ -24,23 +24,6 @@
|
|||
name: sshd
|
||||
when: sshd_install
|
||||
|
||||
|
||||
# UNMAINTAINED
|
||||
- name: Install named / BIND
|
||||
include_tasks: roles/network/tasks/named.yml
|
||||
when: named_install is defined and named_install
|
||||
|
||||
# UNMAINTAINED
|
||||
- name: Install dhcpd
|
||||
include_tasks: roles/network/tasks/dhcpd.yml
|
||||
when: dhcpd_install is defined and dhcpd_install
|
||||
|
||||
# LESS MAINTAINED
|
||||
- name: Install Squid
|
||||
include_tasks: roles/network/tasks/squid.yml
|
||||
when: squid_install and squid_installed is undefined
|
||||
|
||||
|
||||
- name: Install Bluetooth - only on Raspberry Pi
|
||||
include_role:
|
||||
name: bluetooth
|
||||
|
|
|
@ -172,3 +172,5 @@
|
|||
value: "{{ iiab_lan_iface }}"
|
||||
- option: iiab_network_mode
|
||||
value: "{{ iiab_network_mode }}"
|
||||
- option: network_enabled
|
||||
value: "{{ network_enabled }}"
|
||||
|
|
|
@ -50,21 +50,8 @@
|
|||
mode: 0644
|
||||
when: not wifi_up_down and can_be_ap
|
||||
|
||||
- name: Create /usr/bin/iiab-hotspot-on from template
|
||||
template:
|
||||
src: hostapd/iiab-hotspot-on
|
||||
dest: /usr/bin/iiab-hotspot-on
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
|
||||
- name: Create /usr/bin/iiab-hotspot-off from template
|
||||
template:
|
||||
src: hostapd/iiab-hotspot-off
|
||||
dest: /usr/bin/iiab-hotspot-off
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
# 2022-07-11: Install of iiab-hotspot-on|off moved to network/tasks/main.yml
|
||||
# as required for Admin Console
|
||||
|
||||
- name: Create dhcpcd hook for hostapd and ap0 when wifi_up_down True
|
||||
template:
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
# 2022-03-16: 'apt show <pkg> | grep Size' revealed download sizes, on 64-bit RasPiOS with desktop.
|
||||
|
||||
- name: Install dnsmasq -- configure LATER in 'network', after Stage 9
|
||||
include_tasks: roles/network/tasks/dnsmasq.yml
|
||||
|
||||
- name: Install package networkd-dispatcher (OS's other than RasPiOS)
|
||||
package:
|
||||
name: networkd-dispatcher # 15kB download: Dispatcher service for systemd-networkd connection status changes
|
||||
|
@ -16,7 +19,7 @@
|
|||
# total download size) and they can help IIAB field operators with BOTH
|
||||
# (1) internal WiFi AND (2) USB WiFi devices inserted anytime/later.
|
||||
|
||||
- name: 'Install 11 network packages: avahi-daemon, hostapd, iproute2, iptables-persistent, iw, libnss-mdns, netmask, net-tools, rfkill, wpasupplicant, wpasupplicant -- later used by https://github.com/iiab/iiab/tree/master/roles/network'
|
||||
- name: 'Install 11 network packages: avahi-daemon, hostapd, iproute2, iptables-persistent, iw, libnss-mdns, netmask, net-tools, rfkill, wireless-tools, wpasupplicant -- later used by https://github.com/iiab/iiab/tree/master/roles/network'
|
||||
package:
|
||||
name:
|
||||
- avahi-daemon # 97kB download: RasPiOS (and package libnss-mnds, below) install this regardless -- holdover from the XO days and used to advertise ssh/admin-console being available via avahi-daemon -- used with https://github.com/iiab/iiab/blob/master/roles/network/tasks/avahi.yml
|
||||
|
@ -44,7 +47,7 @@
|
|||
|
||||
|
||||
# Ongoing rework (e.g. PR #2652) arising from ansible.posix collection changes:
|
||||
- name: "Use 'sysctl' to set 'kernel.core_uses_pid: 1' + 4 network settings in /etc/sysctl.conf -- e.g. disabling IPv6 (this might be overkill, as IPv6 should really only be disabled on the LAN side, i.e. br0)"
|
||||
- name: "4 network settings in /etc/sysctl.conf -- e.g. disabling IPv6 (this might be overkill, as IPv6 should really only be disabled on the LAN side, i.e. br0)"
|
||||
sysctl: # Places these settings in /etc/sysctl.conf, to survive reboot
|
||||
name: "{{ item.name }}"
|
||||
value: "{{ item.value }}"
|
||||
|
@ -52,10 +55,34 @@
|
|||
- { name: 'net.ipv4.ip_forward', value: '1' } # Masquerading LAN->Internet
|
||||
- { name: 'net.ipv4.conf.default.rp_filter', value: '1' }
|
||||
- { name: 'net.ipv4.conf.default.accept_source_route', value: '0' }
|
||||
#- { name: 'kernel.sysrq', value: '1' } # OS values differ, Ok?
|
||||
- { name: 'kernel.core_uses_pid', value: '1' }
|
||||
#- { name: 'net.ipv4.tcp_syncookies', value: '1' } # Very standard in 2020
|
||||
#- { name: 'kernel.shmmax', value: '268435456' } # OS values differ, Ok?
|
||||
- { name: 'net.ipv6.conf.all.disable_ipv6', value: '1' } # IPv6 disabled
|
||||
#- { name: 'net.ipv6.conf.default.disable_ipv6', value: '1' } # AUTO-SET
|
||||
#- { name: 'net.ipv6.conf.lo.disable_ipv6', value: '1' } # BY ABOVE
|
||||
|
||||
|
||||
# UNMAINTAINED
|
||||
- name: Install named / BIND
|
||||
include_tasks: roles/network/tasks/named.yml
|
||||
when: named_install is defined and named_install
|
||||
|
||||
# UNMAINTAINED
|
||||
- name: Install dhcpd
|
||||
include_tasks: roles/network/tasks/dhcpd.yml
|
||||
when: dhcpd_install is defined and dhcpd_install
|
||||
|
||||
# LESS MAINTAINED
|
||||
- name: Install Squid
|
||||
include_tasks: roles/network/tasks/squid.yml
|
||||
when: squid_install and squid_installed is undefined
|
||||
|
||||
|
||||
- name: "Set 'network_installed: True'"
|
||||
set_fact:
|
||||
network_installed: True
|
||||
|
||||
- name: "Add 'network_installed: True' to {{ iiab_state_file }}"
|
||||
lineinfile:
|
||||
path: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
|
||||
regexp: '^network_installed'
|
||||
line: 'network_installed: True'
|
|
@ -21,59 +21,83 @@
|
|||
- name: computed_network
|
||||
include_tasks: computed_network.yml
|
||||
|
||||
# - name: Configure wondershaper
|
||||
# include_tasks: wondershaper.yml
|
||||
# when: wondershaper_install or wondershaper_installed is defined
|
||||
- name: Install network packages (including many WiFi tools, and also iptables-persistent for firewall)
|
||||
include_tasks: install.yml
|
||||
when: network_install and network_installed is undefined
|
||||
|
||||
- name: (Re)Install named
|
||||
include_tasks: named.yml
|
||||
when: named_install and FQDN_changed and iiab_stage|int == 9
|
||||
- name: Create /usr/bin/iiab-hotspot-on from template
|
||||
template:
|
||||
src: hostapd/iiab-hotspot-on
|
||||
dest: /usr/bin/iiab-hotspot-on
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
|
||||
- name: (Re)Install dhcpd
|
||||
include_tasks: dhcpd.yml
|
||||
when: dhcpd_install and FQDN_changed and iiab_stage|int == 9
|
||||
- name: Create /usr/bin/iiab-hotspot-off from template
|
||||
template:
|
||||
src: hostapd/iiab-hotspot-off
|
||||
dest: /usr/bin/iiab-hotspot-off
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
|
||||
- name: (Re)Install Squid
|
||||
include_tasks: squid.yml
|
||||
when: squid_install and FQDN_changed and iiab_stage|int == 9
|
||||
- name: Configuring Network if enabled
|
||||
block:
|
||||
# - name: Configure wondershaper
|
||||
# include_tasks: wondershaper.yml
|
||||
# when: wondershaper_install or wondershaper_installed is defined
|
||||
|
||||
#preprep for backends
|
||||
- name: Netplan in use on Ubuntu 18.04+
|
||||
include_tasks: netplan.yml
|
||||
when: is_ubuntu and not is_ubuntu_16
|
||||
- name: (Re)Install named
|
||||
include_tasks: named.yml
|
||||
when: named_install and FQDN_changed and iiab_stage|int == 9
|
||||
|
||||
#### Start services
|
||||
- name: avahi
|
||||
include_tasks: avahi.yml
|
||||
- name: hostapd
|
||||
include_tasks: hostapd.yml
|
||||
- name: computed_services
|
||||
include_tasks: computed_services.yml
|
||||
- name: enable_services
|
||||
include_tasks: enable_services.yml
|
||||
#### End services
|
||||
- name: (Re)Install dhcpd
|
||||
include_tasks: dhcpd.yml
|
||||
when: dhcpd_install and FQDN_changed and iiab_stage|int == 9
|
||||
|
||||
#### Start network layout
|
||||
#- name: Redhat networking
|
||||
# include_tasks: ifcfg_mods.yml
|
||||
# when: is_redhat
|
||||
- name: (Re)Install Squid
|
||||
include_tasks: squid.yml
|
||||
when: squid_install and FQDN_changed and iiab_stage|int == 9
|
||||
|
||||
- name: NetworkManager in use
|
||||
include_tasks: NM-debian.yml
|
||||
when: is_debuntu and network_manager_active
|
||||
#preprep for backends
|
||||
- name: Netplan in use on Ubuntu 18.04+
|
||||
include_tasks: netplan.yml
|
||||
when: is_ubuntu and not is_ubuntu_16
|
||||
|
||||
- name: systemd-networkd in use
|
||||
include_tasks: sysd-netd-debian.yml
|
||||
when: is_debuntu and systemd_networkd_active
|
||||
#### Start services
|
||||
- name: avahi
|
||||
include_tasks: avahi.yml
|
||||
- name: hostapd
|
||||
include_tasks: hostapd.yml
|
||||
- name: computed_services
|
||||
include_tasks: computed_services.yml
|
||||
- name: enable_services
|
||||
include_tasks: enable_services.yml
|
||||
#### End services
|
||||
|
||||
- name: Raspbian uses dhcpcd only with no N-M or SYS-NETD active
|
||||
include_tasks: rpi_debian.yml
|
||||
when: is_raspbian
|
||||
#### Start network layout
|
||||
#- name: Redhat networking
|
||||
# include_tasks: ifcfg_mods.yml
|
||||
# when: is_redhat
|
||||
|
||||
- name: Not RPi, Not NetworkManager, Not systemd-networkd in use
|
||||
include_tasks: debian.yml
|
||||
when: (not is_raspbian and not network_manager_active and not systemd_networkd_active and is_debuntu) or is_ubuntu_16
|
||||
#### end network layout
|
||||
- name: NetworkManager in use
|
||||
include_tasks: NM-debian.yml
|
||||
when: is_debuntu and network_manager_active
|
||||
|
||||
- name: Restart services
|
||||
include_tasks: restart.yml
|
||||
- name: systemd-networkd in use
|
||||
include_tasks: sysd-netd-debian.yml
|
||||
when: is_debuntu and systemd_networkd_active
|
||||
|
||||
- name: Raspbian uses dhcpcd only with no N-M or SYS-NETD active
|
||||
include_tasks: rpi_debian.yml
|
||||
when: is_raspbian
|
||||
|
||||
- name: Not RPi, Not NetworkManager, Not systemd-networkd in use
|
||||
include_tasks: debian.yml
|
||||
when: (not is_raspbian and not network_manager_active and not systemd_networkd_active and is_debuntu) or is_ubuntu_16
|
||||
#### end network layout
|
||||
|
||||
- name: Restart services
|
||||
include_tasks: restart.yml
|
||||
# end block
|
||||
when: network_installed is defined and network_enabled
|
||||
|
|
|
@ -92,6 +92,8 @@ js_menu_install: True
|
|||
# IIAB Networking README: https://github.com/iiab/iiab/tree/master/roles/network
|
||||
# IIAB Networking Doc: https://github.com/iiab/iiab/wiki/IIAB-Networking
|
||||
# Read it offline too: http://box/info > "IIAB Networking"
|
||||
network_install: True
|
||||
network_enabled: True
|
||||
|
||||
# NETWORK PARAMETERS FOLLOW ACROSS THE NEXT 100 LINES, as enabled by Ansible's
|
||||
# NETWORK role (/opt/iiab/iiab/roles/network). SEE ALSO:
|
||||
|
|
Loading…
Reference in a new issue