1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +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:
Jerry Vonau 2017-09-13 09:30:59 -05:00
parent fcb0488502
commit de4be7c646
7 changed files with 116 additions and 61 deletions

View file

@ -53,5 +53,5 @@ dhcpd_enabled: True
named_install: True named_install: True
named_enabled: True named_enabled: True
dnsmasq_install: True dnsmasq_install: True
dnsmasq_enabled: True dnsmasq_enabled: False
captive_portal_enabled: False captive_portal_enabled: False

View file

@ -6,10 +6,9 @@
mode=0644 mode=0644
when: iiab_wireless_lan_iface != "none" when: iiab_wireless_lan_iface != "none"
- name: Disable the Access Point hostapd program - name: Disable the Access Point Hostapd program
service: enabled=no service: enabled=no
name=hostapd.service name=hostapd.service
state=stopped
when: iiab_wireless_lan_iface == "none" or iiab_network_mode == "Appliance" or not hostapd_enabled when: iiab_wireless_lan_iface == "none" or iiab_network_mode == "Appliance" or not hostapd_enabled
- name: Use custom systemd unit file to start hostapd - name: Use custom systemd unit file to start hostapd
@ -19,26 +18,7 @@
group=root group=root
mode=0644 mode=0644
- name: Ask systemd to reread the unit files for hostapd - name: Enable the Access Point Hostapd program
shell: systemctl daemon-reload
- name: Enable the Access Point hostapd program
service: enabled=yes service: enabled=yes
name=hostapd.service name=hostapd.service
state=restarted
when: iiab_wireless_lan_iface != "none" and iiab_network_mode != "Appliance" and hostapd_enabled 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

View file

@ -109,23 +109,17 @@
tags: tags:
- network - network
- include: ifcfg_mods.yml - include: hostapd.yml
tags:
- network
- include: ifcfg_mods.yml
when: not is_debuntu and not installing
tags: tags:
- network - network
when: is_redhat and not installing
- include: debian.yml - include: debian.yml
tags: when: is_debuntu and not installing
- 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
tags: tags:
- network - network

View file

@ -40,3 +40,18 @@
- name: Run iptables - name: Run iptables
command: /usr/bin/iiab-gen-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

View file

@ -37,16 +37,21 @@ require dhcp_server_identifier
# Generate Stable Private IPv6 Addresses instead of hardware based ones # Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private slaac private
# don't let dhcpcd mess with IIAB LAN # IIAB
denyinterfaces br0 wlan0 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 dhcpcd_result == "enabled" and iiab_lan_iface == "br0" %}
{% if gui_static_wan == true %} interface {{ iiab_lan_iface }}
interface {{ discovered_wan_iface }} static ip_address={{ lan_ip }}/19
# strange that dhcpcd does not have a netmask option -- hardcode it FIXME static domain_name_servers=127.0.0.1
static ip_address={{ gui_static_wan_ip }}/24 {% endif %}
static routers={{ gui_static_wan_gateway }}
domain_name_servers= {{ gui_static_wan_nameserver }} # 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 %} {% endif %}
# It is possible to fall back to a static IP if DHCP fails: # It is possible to fall back to a static IP if DHCP fails:

View 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 %}

View file

@ -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" %} {% if iiab_network_mode != "Appliance" %}
################# LANCONTROLLER ################### ################# LANCONTROLLER ###################
auto br0 auto br0
{% if dhcpcd_result == "enabled" %}
iface br0 inet manual
{% else %}
iface br0 inet static 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 bridge_maxwait 0
{% if dhcpcd_result != "enabled" %}
address {{ lan_ip }} address {{ lan_ip }}
netmask {{ lan_netmask }} netmask {{ lan_netmask }}
{% if iiab_network_mode == "Gateway" %}
gateway {{ lan_ip }}
{% endif %} {% endif %}
dns-nameservers {{ lan_ip }} dns-nameservers 127.0.0.1
dns-search {{ iiab_domain }} dns-search {{ iiab_domain }}
{% endif %} {% endif %}
{# end LANCONTROLLER #} {# end LANCONTROLLER #}
{% if iiab_network_mode != "LanController" %} {% if iiab_network_mode != "LanController" %}
################# GATEWAY or APPLIANCE ######################### ################# GATEWAY or APPLIANCE #########################
# start dhcp clients
{% if dhcpcd_result == "enabled" or wan_in_interfaces == "true" %} {% if dhcpcd_result == "enabled" or wan_in_interfaces == "true" %}
# client or user defined # client or user defined
{% endif %} {% endif %}
{% if dhcpcd_result == "enabled" and is_rpi == "true" %} {% if dhcpcd_result == "enabled" and is_rpi == "true" %}
#cover rpi #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 }} auto {{ iiab_wan_iface }}
iface {{ iiab_wan_iface }} inet manual iface {{ iiab_wan_iface }} inet dhcp
{% else %} # gui_static_wan_ip is set {% endif %}
iface {{ iiab_wan_iface }} inet manual # end dhcp clients
{% endif %} {# end of dhcp_wan #} # static wan
{% if wan_ip != "dhcp" and dhcpcd_result != "enabled" and wan_in_interfaces == "false" %}
{% if wan_ip != "dhcp" %}
auto {{ iiab_wan_iface }} auto {{ iiab_wan_iface }}
iface {{ iiab_wan_iface }} inet static iface {{ iiab_wan_iface }} inet static
address {{ wan_ip }} address {{ wan_ip }}
netmask {{ wan_netmask }} netmask {{ wan_netmask }}
gateway {{ wan_gateway }} gateway {{ wan_gateway }}
dns-nameservers {{ wan_nameserver }} dns-nameservers 127.0.0.1 {{ wan_nameserver }}
dns-search {{ iiab_domain }} dns-search {{ iiab_domain }}
{% endif %}
{% endif %} {# end of static_wan #} {% endif %} {# end of static_wan #}
{# end of iiab_network_mode != LanController #}
{% endif %} {# end of iiab_network_mode != LanController #}