From 4a649ea0ae12b38a5ef352b0dba174887d5330a4 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 26 Nov 2018 22:08:46 +0100 Subject: [PATCH] Generate accesspoint_wireless_ifaces from a template --- ansible/group_vars/accesspoints/main.yml | 54 ++++++++---------------------- 1 file changed, 14 insertions(+), 40 deletions(-) diff --git a/ansible/group_vars/accesspoints/main.yml b/ansible/group_vars/accesspoints/main.yml index 5c1bc4d..1df3d41 100644 --- a/ansible/group_vars/accesspoints/main.yml +++ b/ansible/group_vars/accesspoints/main.yml @@ -96,51 +96,25 @@ accesspoint_wireless_devices: ## * https://www.reddit.com/r/openwrt/comments/515oea/finally_got_80211r_roaming_working/ ## * https://gist.github.com/lg/998d3e908d547bd9972a6bb604df377b accesspoint_wireless_ifaces: "{{ accesspoint_wireless_ifaces_yaml | from_yaml }}" +accesspoint_wireless_types: + - { name: only, ssid: 2.4, freq: 2g4 } + - { name: only, ssid: 5, freq: 5g } + - { name: '', ssid: '', freq: 2g4 } + - { name: '', ssid: '', freq: 5g } accesspoint_wireless_ifaces_yaml: | - {% for item in accesspoint_zones.keys() %} - - name: wifi-iface '{{ item }}2g4only' - options: - device: 'radio2g4' - network: '{{ item }}' - mode: 'ap' - disassoc_low_ack: '1' - rsn_preauth: '1' - ssid: '{{ accesspoint_zones[item].ssid }}2.4' - encryption: '{{ accesspoint_zones[item].encryption }}' - key: '{{ accesspoint_zones[item].key }}' - - - name: wifi-iface '{{ item }}5gonly' - options: - device: 'radio5g' - network: '{{ item }}' - mode: 'ap' - disassoc_low_ack: '1' - rsn_preauth: '1' - ssid: '{{ accesspoint_zones[item].ssid }}5' - encryption: '{{ accesspoint_zones[item].encryption }}' - key: '{{ accesspoint_zones[item].key }}' - - - name: wifi-iface '{{ item }}2g4' - options: - device: 'radio2g4' - network: '{{ item }}' - mode: 'ap' - disassoc_low_ack: '1' - rsn_preauth: '1' - ssid: '{{ accesspoint_zones[item].ssid }}' - encryption: '{{ accesspoint_zones[item].encryption }}' - key: '{{ accesspoint_zones[item].key }}' - - - name: wifi-iface '{{ item }}5g' + {% for zone in accesspoint_zones.keys() %} + {% for item in accesspoint_wireless_types %} + - name: wifi-iface '{{ zone }}{{ item.freq }}{{ item.name }}' options: - device: 'radio5g' - network: '{{ item }}' + device: 'radio{{ item.freq }}' + network: '{{ zone }}' mode: 'ap' disassoc_low_ack: '1' rsn_preauth: '1' - ssid: '{{ accesspoint_zones[item].ssid }}' - encryption: '{{ accesspoint_zones[item].encryption }}' - key: '{{ accesspoint_zones[item].key }}' + ssid: '{{ accesspoint_zones[zone].ssid }}{{ item.ssid }}' + encryption: '{{ accesspoint_zones[zone].encryption }}' + key: '{{ accesspoint_zones[zone].key }}' + {% endfor %} {% endfor %} -- 1.7.10.4