2017-05-27 18:09:50 +00:00
|
|
|
- name: Create a config file for hostapd
|
|
|
|
template: src=hostapd/hostapd.conf.j2
|
|
|
|
dest=/etc/hostapd/hostapd.conf
|
|
|
|
owner=root
|
|
|
|
group=root
|
|
|
|
mode=0644
|
2017-06-09 23:25:56 +00:00
|
|
|
when: iiab_wireless_lan_iface != "none"
|
2017-05-27 18:09:50 +00:00
|
|
|
|
|
|
|
- name: Disable the Access Point Hostapd program
|
|
|
|
service: enabled=no
|
|
|
|
name=hostapd.service
|
|
|
|
state=stopped
|
2017-06-09 23:25:56 +00:00
|
|
|
when: iiab_wireless_lan_iface == "none" or iiab_network_mode == "Appliance" or not hostapd_enabled
|
2017-05-27 18:09:50 +00:00
|
|
|
|
|
|
|
- name: Use custom systemd unit file to start hostapd
|
|
|
|
template: src=hostapd/hostapd.service.j2
|
|
|
|
dest=/etc/systemd/system/hostapd.service
|
|
|
|
owner=root
|
|
|
|
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
|
|
|
|
service: enabled=yes
|
|
|
|
name=hostapd.service
|
|
|
|
state=restarted
|
2017-06-09 23:25:56 +00:00
|
|
|
when: iiab_wireless_lan_iface != "none" and iiab_network_mode != "Appliance" and hostapd_enabled
|
2017-05-27 18:09:50 +00:00
|
|
|
|
|
|
|
- name: Checking if slave is active waiting 10 seconds
|
2017-06-09 23:25:56 +00:00
|
|
|
shell: "sleep {{ hostapd_wait }} | brctl show | grep {{ iiab_wireless_lan_iface }}"
|
2017-05-27 18:09:50 +00:00
|
|
|
ignore_errors: True
|
|
|
|
changed_when: False
|
|
|
|
register: wifi_slave
|
2017-06-09 23:25:56 +00:00
|
|
|
when: iiab_lan_iface == "br0" and iiab_wireless_lan_iface != "none"
|
2017-05-27 18:09:50 +00:00
|
|
|
|
|
|
|
- name: Restart hostapd if slave is inactive
|
|
|
|
service: name=hostapd.service
|
|
|
|
state=restarted
|
2017-06-09 23:25:56 +00:00
|
|
|
when: is_debuntu and iiab_lan_iface == "br0" and item|trim == ""
|
2017-05-27 18:09:50 +00:00
|
|
|
with_items:
|
|
|
|
- "{{ wifi_slave.stdout }}"
|
|
|
|
ignore_errors: true
|