mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Merge pull request #726 from georgejhunt/fix6.5
fix6.5 - auto-enable hostapd (during Ethernet install of IIAB)
This commit is contained in:
commit
902b473f5b
8 changed files with 60 additions and 30 deletions
|
@ -123,7 +123,7 @@
|
||||||
|
|
||||||
- name: Set python_path (redhat)
|
- name: Set python_path (redhat)
|
||||||
set_fact:
|
set_fact:
|
||||||
python_path: /usr/lib/python2.7/site-packages/
|
python_path: /lib/python2.7/site-packages/
|
||||||
when: is_redhat
|
when: is_redhat
|
||||||
|
|
||||||
- name: Set python_path (debuntu)
|
- name: Set python_path (debuntu)
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
- httpd
|
- httpd
|
||||||
- php
|
- php
|
||||||
- php-curl
|
- php-curl
|
||||||
|
- mod_authnz_external
|
||||||
# - php-sqlite
|
# - php-sqlite
|
||||||
tags:
|
tags:
|
||||||
- download
|
- download
|
||||||
|
|
|
@ -14,13 +14,13 @@ device_gw2: ""
|
||||||
|
|
||||||
iiab_wan_iface: "none"
|
iiab_wan_iface: "none"
|
||||||
iiab_lan_iface: "none"
|
iiab_lan_iface: "none"
|
||||||
#discovered_lan_iface: "none"
|
discovered_lan_iface: "none"
|
||||||
discovered_wired_iface: "none"
|
discovered_wired_iface: "none"
|
||||||
discovered_wireless_iface: "none"
|
discovered_wireless_iface: "none"
|
||||||
#iiab_wired_lan_iface: "none"
|
|
||||||
#iiab_wireless_lan_iface: "none"
|
|
||||||
|
|
||||||
#Redhat
|
#Redhat
|
||||||
|
iiab_wired_lan_iface: "none"
|
||||||
|
iiab_wireless_lan_iface: "none"
|
||||||
has_WAN: False
|
has_WAN: False
|
||||||
has_ifcfg_gw: "none"
|
has_ifcfg_gw: "none"
|
||||||
has_wifi_gw: "none"
|
has_wifi_gw: "none"
|
||||||
|
|
|
@ -130,7 +130,18 @@
|
||||||
- name: LAN configured - 'Gateway' mode
|
- name: LAN configured - 'Gateway' mode
|
||||||
set_fact:
|
set_fact:
|
||||||
iiab_network_mode: "Gateway"
|
iiab_network_mode: "Gateway"
|
||||||
when: iiab_lan_iface != "none" and iiab_wan_iface != "none"
|
when: (iiab_lan_iface != "none" and iiab_wan_iface != "none") or is_rpi
|
||||||
|
|
||||||
|
- name: Force iiab_lan_iface if is_rpi
|
||||||
|
set_fact:
|
||||||
|
iiab_lan_iface: "br0"
|
||||||
|
iiab_wireless_lan_iface: "wlan0"
|
||||||
|
when: is_rpi
|
||||||
|
|
||||||
|
- name: Enable hostapd if discovered_wireless_iface is not WAN
|
||||||
|
set_fact:
|
||||||
|
hostapd_enabled: True
|
||||||
|
when: is_rpi and 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
|
||||||
|
@ -156,6 +167,26 @@
|
||||||
iiab_wan_iface: "none"
|
iiab_wan_iface: "none"
|
||||||
when: adapter_count.stdout|int >= "5" and device_gw == "none" and gui_wan_iface == "unset" and gui_static_wan is defined
|
when: adapter_count.stdout|int >= "5" and device_gw == "none" and gui_wan_iface == "unset" and gui_static_wan is defined
|
||||||
|
|
||||||
|
- name: Record IIAB_WAN_DEVICE to /etc/iiab/iiab.env
|
||||||
|
lineinfile:
|
||||||
|
dest: /etc/iiab/iiab.env
|
||||||
|
regexp: '^IIAB_WAN_DEVICE=*'
|
||||||
|
line: 'IIAB_WAN_DEVICE="{{ iiab_wan_iface }}"'
|
||||||
|
state: present
|
||||||
|
when: not installing #REMOVE THIS LINE IF installing IS ALWAYS false AS SET IN roles/0-init/defaults/main.yml
|
||||||
|
tags:
|
||||||
|
- network
|
||||||
|
|
||||||
|
- name: Record IIAB_LAN_DEVICE to /etc/iiab/iiab.env
|
||||||
|
lineinfile:
|
||||||
|
dest: /etc/iiab/iiab.env
|
||||||
|
regexp: '^IIAB_LAN_DEVICE=*'
|
||||||
|
line: 'IIAB_LAN_DEVICE="{{ iiab_lan_iface }}"'
|
||||||
|
state: present
|
||||||
|
when: not installing #REMOVE THIS LINE IF installing IS ALWAYS false AS SET IN roles/0-init/defaults/main.yml
|
||||||
|
tags:
|
||||||
|
- network
|
||||||
|
|
||||||
- name: Add location section to config file
|
- name: Add location section to config file
|
||||||
ini_file:
|
ini_file:
|
||||||
dest: "{{ iiab_config_file }}"
|
dest: "{{ iiab_config_file }}"
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
when: hostapd_enabled
|
|
||||||
|
|
||||||
- name: Create /usr/bin/iiab-hotspot-on from template
|
- name: Create /usr/bin/iiab-hotspot-on from template
|
||||||
template:
|
template:
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
# clear all bridge ifcfg files
|
# clear all bridge ifcfg files
|
||||||
- name: Now delete slave bridge ifcfg files
|
- name: Now delete slave bridge ifcfg files
|
||||||
shell: rm -f /etc/sysconfig/network-scripts/ifcfg-"{{ item }}"
|
shell: rm -f /etc/sysconfig/network-scripts/ifcfg-"{{ item }}"
|
||||||
|
ignore_errors: True
|
||||||
when: num_lan_interfaces != 0 or iiab_wireless_lan_iface != "none"
|
when: num_lan_interfaces != 0 or iiab_wireless_lan_iface != "none"
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ ifcfg_slaves.stdout_lines }}"
|
- "{{ ifcfg_slaves.stdout_lines }}"
|
||||||
|
|
|
@ -142,27 +142,6 @@
|
||||||
tags:
|
tags:
|
||||||
- network
|
- network
|
||||||
|
|
||||||
# this is moving
|
|
||||||
- name: Record IIAB_WAN_DEVICE to /etc/iiab/iiab.env
|
|
||||||
lineinfile:
|
|
||||||
dest: /etc/iiab/iiab.env
|
|
||||||
regexp: '^IIAB_WAN_DEVICE=*'
|
|
||||||
line: 'IIAB_WAN_DEVICE="{{ iiab_wan_iface }}"'
|
|
||||||
state: present
|
|
||||||
when: not installing #REMOVE THIS LINE IF installing IS ALWAYS false AS SET IN roles/0-init/defaults/main.yml
|
|
||||||
tags:
|
|
||||||
- network
|
|
||||||
|
|
||||||
- name: Record IIAB_LAN_DEVICE to /etc/iiab/iiab.env
|
|
||||||
lineinfile:
|
|
||||||
dest: /etc/iiab/iiab.env
|
|
||||||
regexp: '^IIAB_LAN_DEVICE=*'
|
|
||||||
line: 'IIAB_LAN_DEVICE="{{ iiab_lan_iface }}"'
|
|
||||||
state: present
|
|
||||||
when: not installing #REMOVE THIS LINE IF installing IS ALWAYS false AS SET IN roles/0-init/defaults/main.yml
|
|
||||||
tags:
|
|
||||||
- network
|
|
||||||
|
|
||||||
#### end network layout
|
#### end network layout
|
||||||
- include_tasks: restart.yml
|
- include_tasks: restart.yml
|
||||||
when: not installing
|
when: not installing
|
||||||
|
|
|
@ -20,10 +20,26 @@
|
||||||
dest: /etc/dhcpcd.conf
|
dest: /etc/dhcpcd.conf
|
||||||
src: network/dhcpcd.conf.j2
|
src: network/dhcpcd.conf.j2
|
||||||
|
|
||||||
|
- name: New raspbian requires counry code -- check for it
|
||||||
|
shell: grep country /etc/wpa_supplicant/wpa_supplicant.conf
|
||||||
|
register: country_code
|
||||||
|
ignore_errors: True
|
||||||
|
|
||||||
|
- name: Put a country code if it does not exist
|
||||||
|
lineinfile:
|
||||||
|
dest: /etc/wpa_supplicant/wpa_supplicant.conf
|
||||||
|
regexp: "^country.*"
|
||||||
|
line: country={{ host_country_code }}
|
||||||
|
when: country_code is defined and country_code.stdout == ""
|
||||||
|
|
||||||
|
- name: Enable the wifi with rfkill
|
||||||
|
shell: rfkill unblock 0
|
||||||
|
ignore_errors: True
|
||||||
|
|
||||||
- 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/iiab.j2
|
||||||
when: iiab_lan_iface == "br0"
|
when: iiab_lan_iface == "br0"
|
||||||
|
|
||||||
- name: Stopping services
|
- name: Stopping services
|
||||||
|
@ -48,9 +64,12 @@
|
||||||
- name: Restart hostapd if appropriate
|
- name: Restart hostapd if appropriate
|
||||||
service:
|
service:
|
||||||
name: hostapd
|
name: hostapd
|
||||||
enabled: yes
|
|
||||||
state: restarted
|
state: restarted
|
||||||
when: hostapd_enabled and iiab_wireless_lan_iface is defined and iiab_network_mode != "Appliance"
|
when: hostapd_enabled and iiab_wan_iface != discovered_wireless_iface and iiab_network_mode != "Appliance"
|
||||||
|
|
||||||
|
- name: Ansible is having a problem enabling services
|
||||||
|
shell: systemctl enable hostapd
|
||||||
|
when: hostapd_enabled and iiab_wan_iface != discovered_wireless_iface and iiab_network_mode != "Appliance"
|
||||||
|
|
||||||
#- name: dhcp_server may be affected - starting - user choice
|
#- name: dhcp_server may be affected - starting - user choice
|
||||||
# service: name={{ dhcp_service2 }} state=started
|
# service: name={{ dhcp_service2 }} state=started
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue