1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-14 20:22:08 +00:00

grouping, recording, staging

This commit is contained in:
Jerry Vonau 2023-04-23 16:11:03 -05:00
parent cf67d4c9d7
commit ef6486b09b
5 changed files with 43 additions and 42 deletions

View file

@ -81,22 +81,3 @@
value: "{{ dnsmasq_enabled }}"
- option: no_net_restart
value: "{{ no_net_restart }}"
- option: hostapd_enabled
value: "{{ hostapd_enabled }}"
- option: host_ssid
value: "{{ host_ssid }}"
- option: host_wifi_mode
value: "{{ host_wifi_mode }}"
- option: host_channel
value: "{{ host_channel }}"
- name: Add 'network' variable 'current_client_channel' value if defined, to {{ iiab_ini_file }}
ini_file:
dest: "{{ iiab_ini_file }}"
section: network
option: "{{ item.option }}"
value: "{{ item.value | string }}"
with_items:
- option: client_wifi_channel
value: "{{ current_client_channel.stdout }}"
when: current_client_channel.stdout is defined

View file

@ -9,6 +9,17 @@
enabled: no
when: not hostapd_enabled
- name: Detect WiFi country code in use
shell: iw reg get | grep country | grep -v UNSET | awk '{print $2}' | sed "s|:||"
register: REG_DOM
ignore_errors: True
when: wifi_up_down and can_be_ap and has_wifi_gateway is defined
- name: Set Wifi Region country code for hostapd when present
set_fact:
host_country_code: "{{ REG_DOM.stdout }}"
when: REG_DOM.stdout is defined and REG_DOM.stdout | length > 0
- name: Detect current Wifi channel
shell: iw {{ discovered_wireless_iface }} info | grep channel | cut -d' ' -f2
register: current_client_channel
@ -88,3 +99,32 @@
regexp: '^HOSTAPD_ENABLED=*'
line: 'HOSTAPD_ENABLED={{ hostapd_enabled }}'
state: present
- name: Record host_country_code_applied and host_channel in network of {{ iiab_ini_file }}
ini_file:
dest: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini
section: network
option: "{{ item.option }}"
value: "{{ item.value | string }}"
with_items:
- option: hostapd_enabled
value: "{{ hostapd_enabled }}"
- option: host_ssid
value: "{{ host_ssid }}"
- option: host_wifi_mode
value: "{{ host_wifi_mode }}"
- option: host_country_code_applied
value: "{{ host_country_code }}"
- option: host_channel
value: "{{ host_channel }}"
- name: Add 'network' variable 'current_client_channel' value if defined, to {{ iiab_ini_file }}
ini_file:
dest: "{{ iiab_ini_file }}"
section: network
option: "{{ item.option }}"
value: "{{ item.value | string }}"
with_items:
- option: client_wifi_channel
value: "{{ current_client_channel.stdout }}"
when: current_client_channel.stdout is defined

View file

@ -61,8 +61,6 @@
# when: squid_install and FQDN_changed and iiab_stage|int == 9
#### Start services
- name: hostapd
include_tasks: hostapd.yml
- name: computed_services
include_tasks: computed_services.yml
- name: enable_services
@ -94,6 +92,9 @@
#when: (not is_raspbian and not network_manager_active and not systemd_networkd_active and is_debuntu) or is_ubuntu_16
#### end network layout
- name: hostapd
include_tasks: hostapd.yml
- name: Restart services
include_tasks: restart.yml

View file

@ -14,16 +14,6 @@
- wpa_supplicant
when: wifi_up_down and hostapd_enabled
- name: Record host_country_code_applied in network of iiab_ini_file
ini_file:
dest: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini
section: network
option: "{{ item.option }}"
value: "{{ item.value | string }}"
with_items:
- option: host_country_code_applied
value: "{{ host_country_code }}"
- name: Create /etc/hostapd/hostapd.conf and backup .iiab from template if needed
template:
owner: root

View file

@ -87,17 +87,6 @@
systemd:
daemon_reload: yes
- name: Detect WiFi country code in use
shell: iw reg get | grep country | grep -v UNSET | awk '{print $2}' | sed "s|:||"
register: REG_DOM
ignore_errors: True
when: wifi_up_down and can_be_ap and has_wifi_gateway is defined
- name: Set Wifi Region country code for hostapd when present
set_fact:
host_country_code: "{{ REG_DOM.stdout }}"
when: REG_DOM.stdout is defined and REG_DOM.stdout | length > 0
- name: Clone wifi if needed
systemd:
name: iiab-clone-wifi