mirror of
https://github.com/iiab/iiab.git
synced 2025-02-12 11:12:06 +00:00
Everybody is testing debian.yml - Toggle dnsmasq_enabled False - edits
use hostapd.yml supplied templates sooner - remove systemd reload and restarted - move restarted to restart.yml live testing
This commit is contained in:
parent
fcb0488502
commit
de4be7c646
7 changed files with 116 additions and 61 deletions
|
@ -53,5 +53,5 @@ dhcpd_enabled: True
|
|||
named_install: True
|
||||
named_enabled: True
|
||||
dnsmasq_install: True
|
||||
dnsmasq_enabled: True
|
||||
dnsmasq_enabled: False
|
||||
captive_portal_enabled: False
|
||||
|
|
|
@ -6,10 +6,9 @@
|
|||
mode=0644
|
||||
when: iiab_wireless_lan_iface != "none"
|
||||
|
||||
- name: Disable the Access Point hostapd program
|
||||
- name: Disable the Access Point Hostapd program
|
||||
service: enabled=no
|
||||
name=hostapd.service
|
||||
state=stopped
|
||||
when: iiab_wireless_lan_iface == "none" or iiab_network_mode == "Appliance" or not hostapd_enabled
|
||||
|
||||
- name: Use custom systemd unit file to start hostapd
|
||||
|
@ -19,26 +18,7 @@
|
|||
group=root
|
||||
mode=0644
|
||||
|
||||
- name: Ask systemd to reread the unit files for hostapd
|
||||
shell: systemctl daemon-reload
|
||||
|
||||
- name: Enable the Access Point hostapd program
|
||||
- name: Enable the Access Point Hostapd program
|
||||
service: enabled=yes
|
||||
name=hostapd.service
|
||||
state=restarted
|
||||
when: iiab_wireless_lan_iface != "none" and iiab_network_mode != "Appliance" and hostapd_enabled
|
||||
|
||||
- name: Checking if slave is active waiting 10 seconds
|
||||
shell: "sleep {{ hostapd_wait }} | brctl show | grep {{ iiab_wireless_lan_iface }}"
|
||||
ignore_errors: True
|
||||
changed_when: False
|
||||
register: wifi_slave
|
||||
when: iiab_lan_iface == "br0" and iiab_wireless_lan_iface != "none"
|
||||
|
||||
- name: Restart hostapd if slave is inactive
|
||||
service: name=hostapd.service
|
||||
state=restarted
|
||||
when: is_debuntu and iiab_lan_iface == "br0" and item|trim == ""
|
||||
with_items:
|
||||
- "{{ wifi_slave.stdout }}"
|
||||
ignore_errors: true
|
||||
|
|
|
@ -109,23 +109,17 @@
|
|||
tags:
|
||||
- network
|
||||
|
||||
- include: ifcfg_mods.yml
|
||||
- include: hostapd.yml
|
||||
tags:
|
||||
- network
|
||||
|
||||
- include: ifcfg_mods.yml
|
||||
when: not is_debuntu and not installing
|
||||
tags:
|
||||
- network
|
||||
when: is_redhat and not installing
|
||||
|
||||
- include: debian.yml
|
||||
tags:
|
||||
- network
|
||||
when: is_debuntu and not is_rpi and not installing
|
||||
|
||||
- include: rpi_debian.yml
|
||||
tags:
|
||||
- network
|
||||
when: is_debuntu and is_rpi and not installing
|
||||
|
||||
- include: hostapd.yml
|
||||
when: not installing
|
||||
when: is_debuntu and not installing
|
||||
tags:
|
||||
- network
|
||||
|
||||
|
|
|
@ -40,3 +40,18 @@
|
|||
|
||||
- name: Run iptables
|
||||
command: /usr/bin/iiab-gen-iptables
|
||||
|
||||
- name: Checking if slave is active waiting 10 seconds
|
||||
shell: "sleep {{ hostapd_wait }} | brctl show | grep {{ iiab_wireless_lan_iface }}"
|
||||
ignore_errors: True
|
||||
changed_when: False
|
||||
register: wifi_slave
|
||||
when: iiab_lan_iface == "br0" and iiab_wireless_lan_iface != "none"
|
||||
|
||||
- name: Restart hostapd if slave is inactive
|
||||
service: name=hostapd.service
|
||||
state=restarted
|
||||
when: iiab_lan_iface == "br0" and item|trim == ""
|
||||
with_items:
|
||||
- "{{ wifi_slave.stdout }}"
|
||||
ignore_errors: true
|
||||
|
|
|
@ -37,16 +37,21 @@ require dhcp_server_identifier
|
|||
# Generate Stable Private IPv6 Addresses instead of hardware based ones
|
||||
slaac private
|
||||
|
||||
# don't let dhcpcd mess with IIAB LAN
|
||||
denyinterfaces br0 wlan0
|
||||
# IIAB
|
||||
denyinterfaces {% if iiab_wireless_lan_iface != "none" %} {{ iiab_wireless_lan_iface }} {% endif %} {% if discovered_lan_iface != "none" %} {{ discovered_lan_iface }} {% endif %} {% if iiab_lan_iface != "br0" %} {{ iiab_lan_iface }} {% endif %}
|
||||
|
||||
# Example static IP configuration:
|
||||
{% if gui_static_wan == true %}
|
||||
interface {{ discovered_wan_iface }}
|
||||
# strange that dhcpcd does not have a netmask option -- hardcode it FIXME
|
||||
static ip_address={{ gui_static_wan_ip }}/24
|
||||
static routers={{ gui_static_wan_gateway }}
|
||||
domain_name_servers= {{ gui_static_wan_nameserver }}
|
||||
{% if dhcpcd_result == "enabled" and iiab_lan_iface == "br0" %}
|
||||
interface {{ iiab_lan_iface }}
|
||||
static ip_address={{ lan_ip }}/19
|
||||
static domain_name_servers=127.0.0.1
|
||||
{% endif %}
|
||||
|
||||
# IIAB static IP configuration:
|
||||
{% if wan_ip != dhcp %}
|
||||
interface {{ iiab_wan_iface }}
|
||||
static ip_address={{ wan_ip }}/24
|
||||
static routers={{ wan_gateway }}
|
||||
domain_name_servers= {{ wan_nameserver }}
|
||||
{% endif %}
|
||||
|
||||
# It is possible to fall back to a static IP if DHCP fails:
|
||||
|
|
50
roles/network/templates/network/dhcpcd.conf.j2
Normal file
50
roles/network/templates/network/dhcpcd.conf.j2
Normal file
|
@ -0,0 +1,50 @@
|
|||
# Supplied by IIAB
|
||||
# A sample configuration for dhcpcd.
|
||||
# See dhcpcd.conf(5) for details.
|
||||
|
||||
# Allow users of this group to interact with dhcpcd via the control socket.
|
||||
#controlgroup wheel
|
||||
|
||||
# Inform the DHCP server of our hostname for DDNS.
|
||||
hostname
|
||||
|
||||
# Use the hardware address of the interface for the Client ID.
|
||||
clientid
|
||||
# or
|
||||
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
|
||||
# Some non-RFC compliant DHCP servers do not reply with this set.
|
||||
# In this case, comment out duid and enable clientid above.
|
||||
#duid
|
||||
|
||||
# Persist interface configuration when dhcpcd exits.
|
||||
persistent
|
||||
|
||||
# Rapid commit support.
|
||||
# Safe to enable by default because it requires the equivalent option set
|
||||
# on the server to actually work.
|
||||
option rapid_commit
|
||||
|
||||
# A list of options to request from the DHCP server.
|
||||
option domain_name_servers, domain_name, domain_search, host_name
|
||||
option classless_static_routes
|
||||
# Most distributions have NTP support.
|
||||
option ntp_servers
|
||||
# Respect the network MTU. This is applied to DHCP routes.
|
||||
option interface_mtu
|
||||
|
||||
# A ServerID is required by RFC2131.
|
||||
require dhcp_server_identifier
|
||||
|
||||
# Generate Stable Private IPv6 Addresses instead of hardware based ones
|
||||
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 dhcpcd_result == "enabled" and iiab_lan_iface == "br0" %}
|
||||
interface {{ iiab_lan_iface }}
|
||||
static ip_address={{ lan_ip }}/19
|
||||
static routers={{ lan_ip }}
|
||||
static domain_name_servers={{ lan_ip }}
|
||||
{% endif %}
|
|
@ -1,42 +1,53 @@
|
|||
# iiab_network_mode is {{ iiab_network_mode }}
|
||||
# gui_desired_network_role is {{ gui_desired_network_role }}
|
||||
|
||||
{% if iiab_network_mode != "Appliance" %}
|
||||
################# LANCONTROLLER ###################
|
||||
auto br0
|
||||
{% if dhcpcd_result == "enabled" %}
|
||||
iface br0 inet manual
|
||||
{% else %}
|
||||
iface br0 inet static
|
||||
bridge_ports {% if iiab_wireless_lan_iface != "none" %} {{ iiab_wireless_lan_iface }} {% endif %} {% if discovered_lan_iface != "none" %} {{ discovered_lan_iface }} {% endif %}
|
||||
|
||||
{% endif %}
|
||||
{% if discovered_lan_iface != "none" %}
|
||||
bridge_ports {{ discovered_lan_iface }}
|
||||
{% endif %}
|
||||
bridge_maxwait 0
|
||||
{% if dhcpcd_result != "enabled" %}
|
||||
address {{ lan_ip }}
|
||||
netmask {{ lan_netmask }}
|
||||
{% if iiab_network_mode == "Gateway" %}
|
||||
gateway {{ lan_ip }}
|
||||
{% endif %}
|
||||
dns-nameservers {{ lan_ip }}
|
||||
{% endif %}
|
||||
dns-nameservers 127.0.0.1
|
||||
dns-search {{ iiab_domain }}
|
||||
{% endif %}
|
||||
{# end LANCONTROLLER #}
|
||||
|
||||
{% if iiab_network_mode != "LanController" %}
|
||||
################# GATEWAY or APPLIANCE #########################
|
||||
# start dhcp clients
|
||||
{% if dhcpcd_result == "enabled" or wan_in_interfaces == "true" %}
|
||||
# client or user defined
|
||||
{% endif %}
|
||||
|
||||
{% if dhcpcd_result == "enabled" and is_rpi == "true" %}
|
||||
#cover rpi
|
||||
#auto {{ iiab_wan_iface }}
|
||||
#iface {{ iiab_wan_iface }} inet manual
|
||||
{% endif %}
|
||||
{% if dhcpcd_result != "enabled" and wan_in_interfaces == "false" %}
|
||||
#cover butt
|
||||
auto {{ iiab_wan_iface }}
|
||||
iface {{ iiab_wan_iface }} inet manual
|
||||
{% else %} # gui_static_wan_ip is set
|
||||
iface {{ iiab_wan_iface }} inet manual
|
||||
{% endif %} {# end of dhcp_wan #}
|
||||
|
||||
{% if wan_ip != "dhcp" %}
|
||||
iface {{ iiab_wan_iface }} inet dhcp
|
||||
{% endif %}
|
||||
# end dhcp clients
|
||||
# static wan
|
||||
{% if wan_ip != "dhcp" and dhcpcd_result != "enabled" and wan_in_interfaces == "false" %}
|
||||
auto {{ iiab_wan_iface }}
|
||||
iface {{ iiab_wan_iface }} inet static
|
||||
address {{ wan_ip }}
|
||||
netmask {{ wan_netmask }}
|
||||
gateway {{ wan_gateway }}
|
||||
dns-nameservers {{ wan_nameserver }}
|
||||
dns-nameservers 127.0.0.1 {{ wan_nameserver }}
|
||||
dns-search {{ iiab_domain }}
|
||||
{% endif %}
|
||||
{% endif %} {# end of static_wan #}
|
||||
{# end of iiab_network_mode != LanController #}
|
||||
|
||||
{% endif %} {# end of iiab_network_mode != LanController #}
|
||||
|
|
Loading…
Reference in a new issue