1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Merge pull request #741 from jvonau/hostapd_glitch

fix enabling hostapd
This commit is contained in:
A Holt 2018-04-19 11:33:56 -04:00 committed by GitHub
commit d2d2cb1fea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 45 additions and 89 deletions

View file

@ -19,11 +19,11 @@ fi
OS="unknown" # will be overridden below, if /etc/iiab/iiab.env is legit
if [ -f /etc/iiab/iiab.env ]; then
echo "Running /etc/iiab/iiab.env"
echo "Reading /etc/iiab/iiab.env"
source /etc/iiab/iiab.env
fi
echo "Ansible will now run iiab-network.yml -- monitor log file iiab-network.log"
echo "Ansible will now run iiab-network.yml -- log file is iiab-network.log"
Start=`date`
ansible-playbook -i ansible_hosts iiab-network.yml --connection=local
End=`date`

View file

@ -29,22 +29,11 @@
when: iiab_wireless_lan_iface is defined and hostapd_enabled and iiab_network_mode != "Appliance"
- name: Reload systemd
shell: systemctl daemon-reload
systemd:
daemon_reload: yes
- name: Restart the NetworkManager service
service:
systemd:
name: network-manager
state: restarted
when: not nobridge is defined and not no_net_restart
- name: Restart hostapd when WiFi is present
service:
name: hostapd
state: restarted
when: iiab_wireless_lan_iface is defined and hostapd_enabled and iiab_network_mode != "Appliance"
- name: dhcp_server may be affected - starting - user choice
service:
name: "{{ dhcp_service2 }}"
state: started
when: iiab_network_mode != "Appliance"

View file

@ -58,7 +58,8 @@
when: dnsmasq_install
- name: Reload systemd
shell: systemctl daemon-reload
systemd:
daemon_reload: yes
# now pick up denyinterfaces
- name: Restart dhcpcd
@ -68,11 +69,3 @@
- name: Restart the networking service
service: name=networking state=restarted
when: not nobridge is defined and not no_net_restart
- name: Restart hostapd when WiFi is present
service: name=hostapd state=restarted
when: iiab_wireless_lan_iface is defined and hostapd_enabled and iiab_network_mode != "Appliance"
#- name: dhcp_server may be affected - starting - user choice
# service: name={{ dhcp_service2 }} state=started
# when: iiab_network_mode != "Appliance"

View file

@ -1,9 +1,3 @@
- name: Disable the Access Point 'hostapd' service
service: enabled=no
name=hostapd.service
when: not iiab_wireless_lan_iface is defined or iiab_network_mode == "Appliance"
#or not hostapd_enabled
- name: Disable dhcpd service
service: name=dhcpd
enabled=no

View file

@ -16,12 +16,6 @@
mode: 0644
when: discovered_wireless_iface is defined
- name: Disable the Access Point 'hostapd' service
service:
enabled: no
name: hostapd.service
when: not hostapd_enabled
- name: Use custom systemd unit file to start 'hostapd' service
template:
src: hostapd/hostapd.service.j2
@ -37,6 +31,7 @@
owner: root
group: root
mode: 0755
when: is_rpi
- name: Create /usr/bin/iiab-hotspot-off from template
template:
@ -45,10 +40,24 @@
owner: root
group: root
mode: 0755
when: is_rpi
- name: Enable/Restart the Access Point 'hostapd' service
service:
# enabled: yes
state: restarted
name: hostapd.service
- name: Disable the Access Point 'hostapd' service
systemd:
name: hostapd
enabled: no
# cheap workaround for when /etc/init.d is populated
# when: not hostapd_enabled
- name: Enable the Access Point 'hostapd' service
systemd:
name: hostapd
enabled: yes
when: hostapd_enabled and iiab_wireless_lan_iface is defined and iiab_network_mode != "Appliance"
- name: Record HOSTAPD_ENABLED to /etc/iiab/iiab.env
lineinfile:
dest: /etc/iiab/iiab.env
regexp: '^HOSTAPD_ENABLED=*'
line: 'HOSTAPD_ENABLED={{ hostapd_enabled }}'
state: present

View file

@ -1,6 +1,7 @@
- name: Stop the Access Point hostapd program
service: name=hostapd.service
state=stopped
systemd:
name: hostapd
state: stopped
when: iiab_wireless_lan_iface != "none"
# might need an exclude for F18 here
@ -81,7 +82,8 @@
when: not installing and not iiab_demo_mode
- name: ask systemd to reread the unit files, picks up changes done
shell: systemctl daemon-reload
systemd:
daemon_reload: yes
when: not installing
# monitor-connection-files defaults to no with F21, F18-F20 defaults to yes

View file

@ -12,23 +12,13 @@
# (2) debian.yml, (3) rpi_debian.yml
when: discovered_wireless_iface == iiab_wan_iface and not reboot_to_AP
# EITHER WAY: hostapd_enabled's state is RECORDED into /etc/iiab/iiab.env
# (happens just below) for later use by...
# in hostapd.yml for later use by...
# /usr/libexec/iiab-startup.sh, iiab-hotspot-off & iiab-hotspot-on
#
# Separate Idea, Not Without Risks: should WiFi-as-gateway detection logic
# be encapsulated into roles/network/tasks/hostapd.yml in future? Whereas
# today "./runtags hostapd" doesn't exist & "./runtags AP" is UNSUPPORTED!
- name: Record HOSTAPD_ENABLED to /etc/iiab/iiab.env
lineinfile:
dest: /etc/iiab/iiab.env
regexp: '^HOSTAPD_ENABLED=*'
line: 'HOSTAPD_ENABLED={{ hostapd_enabled }}'
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: RPi - reboot to AP post install - installed via wifi so the services are ready
# set_fact:
# iiab_lan_iface: br0

View file

@ -1,6 +1,8 @@
#- name: restart hostapd when wifi is present
# service: name=hostapd state=started
# when: iiab_wireless_lan_iface is defined and hostapd_enabled
- name: restart hostapd when wifi is present
systemd:
name: hostapd
state: restarted
when: iiab_wireless_lan_iface is defined and hostapd_enabled and iiab_network_mode != "Appliance"
- name: Start named service
service:
@ -63,8 +65,8 @@
register: wifi_slave
- name: Restart hostapd if WiFi slave is inactive
service:
name: hostapd.service
systemd:
name: hostapd
state: restarted
when: hostapd_enabled and wifi_slave.stdout is defined and wifi_slave.stdout == 0

View file

@ -46,7 +46,8 @@
include_tasks: down-debian.yml
- name: Reload systemd
shell: systemctl daemon-reload
systemd:
daemon_reload: yes
# now pick up denyinterfaces
- name: Restart dhcpcd
@ -60,17 +61,3 @@
enabled: yes
state: restarted
when: not nobridge is defined and not no_net_restart
- name: Restart hostapd if appropriate
service:
name: hostapd
state: restarted
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
# service: name={{ dhcp_service2 }} state=started
# when: iiab_network_mode != "Appliance"

View file

@ -19,22 +19,12 @@
include_tasks: down-debian.yml
- name: Reload systemd
shell: systemctl daemon-reload
systemd:
daemon_reload: yes
- name: Restart the systemd-networkd service
service:
systemd:
name: systemd-networkd
enabled: yes
state: restarted
when: not nobridge is defined and not no_net_restart
- name: Restart hostapd when WiFi is present
service:
name: hostapd
enabled: yes
state: restarted
when: iiab_wireless_lan_iface is defined and hostapd_enabled and iiab_network_mode != "Appliance"
#- name: dhcp_server may be affected - starting - user choice
# service: name={{ dhcp_service2 }} state=started
# when: iiab_network_mode != "Appliance"