2019-08-15 11:09:22 +00:00
|
|
|
- name: Turn off hostapd when no wifi interface present or in "Appliance Mode"
|
|
|
|
set_fact:
|
|
|
|
hostapd_enabled: False
|
|
|
|
when: not iiab_wireless_lan_iface is defined or iiab_network_mode == "Appliance"
|
|
|
|
|
2017-12-28 22:13:22 +00:00
|
|
|
- name: Create /etc/hostapd/hostapd.conf from template
|
2017-12-29 00:08:13 +00:00
|
|
|
template:
|
|
|
|
src: hostapd/hostapd.conf.j2
|
|
|
|
dest: /etc/hostapd/hostapd.conf
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
2019-08-15 14:14:08 +00:00
|
|
|
when: discovered_wireless_iface != "none"
|
2017-11-13 05:35:34 +00:00
|
|
|
|
2019-08-15 11:09:22 +00:00
|
|
|
- name: Create backup /etc/hostapd/hostapd.conf.iiab from template
|
2017-12-29 00:08:13 +00:00
|
|
|
template:
|
|
|
|
src: hostapd/iiab-hostapd.conf.j2
|
|
|
|
dest: /etc/hostapd/hostapd.conf.iiab
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
2019-08-15 13:39:54 +00:00
|
|
|
when: discovered_wireless_iface != "none"
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2017-11-08 06:53:19 +00:00
|
|
|
- name: Use custom systemd unit file to start 'hostapd' service
|
2017-12-29 00:08:13 +00:00
|
|
|
template:
|
|
|
|
src: hostapd/hostapd.service.j2
|
|
|
|
dest: /etc/systemd/system/hostapd.service
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
2019-08-15 13:39:54 +00:00
|
|
|
when: discovered_wireless_iface != "none"
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2017-12-28 22:13:22 +00:00
|
|
|
- name: Create /usr/bin/iiab-hotspot-on from template
|
2017-12-29 00:08:13 +00:00
|
|
|
template:
|
|
|
|
src: network/iiab-hotspot-on
|
|
|
|
dest: /usr/bin/iiab-hotspot-on
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0755
|
2020-03-04 23:00:01 +00:00
|
|
|
when: is_raspbian | bool
|
2017-11-19 00:48:13 +00:00
|
|
|
|
2017-12-28 22:13:22 +00:00
|
|
|
- name: Create /usr/bin/iiab-hotspot-off from template
|
2017-12-29 00:08:13 +00:00
|
|
|
template:
|
|
|
|
src: network/iiab-hotspot-off
|
|
|
|
dest: /usr/bin/iiab-hotspot-off
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0755
|
2020-03-04 23:00:01 +00:00
|
|
|
when: is_raspbian | bool
|
2017-11-19 00:48:13 +00:00
|
|
|
|
2018-04-07 21:45:04 +00:00
|
|
|
- name: Disable the Access Point 'hostapd' service
|
|
|
|
systemd:
|
|
|
|
name: hostapd
|
|
|
|
enabled: no
|
2018-04-09 00:22:57 +00:00
|
|
|
# cheap workaround for when /etc/init.d is populated
|
|
|
|
# when: not hostapd_enabled
|
2018-04-07 21:45:04 +00:00
|
|
|
|
|
|
|
- name: Enable the Access Point 'hostapd' service
|
|
|
|
systemd:
|
|
|
|
name: hostapd
|
|
|
|
enabled: yes
|
2019-08-15 11:09:22 +00:00
|
|
|
when: hostapd_enabled
|
2018-04-09 00:46:31 +00:00
|
|
|
|
2018-10-15 10:41:58 +00:00
|
|
|
- name: Record HOSTAPD_ENABLED to {{ iiab_env_file }}
|
2018-04-09 00:46:31 +00:00
|
|
|
lineinfile:
|
2020-02-04 00:54:04 +00:00
|
|
|
path: "{{ iiab_env_file }}"
|
2018-04-09 00:46:31 +00:00
|
|
|
regexp: '^HOSTAPD_ENABLED=*'
|
|
|
|
line: 'HOSTAPD_ENABLED={{ hostapd_enabled }}'
|
|
|
|
state: present
|