ansible-labb-wifi/wireless-setup.yml
Martin Kennedy d265d2d9f7 feat: wifi-iface: Implement mesh_mode variant
- Use empty 'ssid:' in your template when you want it to be removed but
the mesh_id added

- Add an stp network.device option so mesh loops don't break things
2022-07-26 12:42:33 -04:00

75 lines
2.6 KiB
YAML

- hosts: openwrt
roles:
- gekmihesg.openwrt
tasks:
- name: Setup network devices
uci:
command: section
config: network
type: device
find_by:
name: "{{ item.name }}"
value:
type: "{{ item.type }}"
ports: "{{ item.ports }}"
stp: "{{ item.stp | default() }}"
loop: "{{ network['device'] }}"
- name: Setup network interfaces
uci:
command: section
config: network
type: interface
name: "{{ item.key }}"
value:
device: "{{ item.device }}"
proto: "{{ item.proto }}"
loop: "{{ network['interface'] }}"
- name: commit changes
uci:
command: commit
key: network
notify: restart network
- name: Setup wireless devices (radios)
uci:
command: section
config: wireless
type: wifi-device
find_by:
path: "{{ item.path }}"
value:
band: "{{ item.band | default(wifi_device[item.template].band) }}"
channel: "{{ item.channel | default(wifi_device[item.template].channel) }}"
country: "{{ item.country | default(wifi_device[item.template].country) }}"
disabled: "{{ item.disabled | default(wifi_device[item.template].disabled) }}"
htmode: "{{ item.htmode | default(wifi_device[item.template].htmode) }}"
loop: "{{ wireless['wifi_device'] }}"
- name: Setup wireless ifaces (VIFs)
uci:
command: section
config: wireless
type: wifi-iface
find:
ifname: "{{ item.ifname | default(wifi_iface[item.template].ifname) | default('') }}"
value:
ifname: "{{ item.ifname | default(wifi_iface[item.template].ifname) | default('') }}"
mode: "{{ item.mode | default(wifi_iface[item.template].mode) }}"
device: "{{ item.device | default(wifi_iface[item.template].device) }}"
network: "{{ item.network | default(wifi_iface[item.template].network) }}"
ssid: "{{ item.ssid | default(wifi_iface[item.template].ssid) | default() }}"
mesh_id: "{{ item.mesh_id | default(wifi_iface[item.template].mesh_id) | default() }}"
encryption: "{{ item.encryption | default(wifi_iface[item.template].encryption) }}"
key: "{{ item.key | default(wifi_iface[item.template].key) }}"
disabled: "{{ item.disabled | default(wifi_iface[item.template].disabled) | default(0) }}"
loop: "{{ wireless['wifi_iface'] }}"
- name: commit changes
uci:
command: commit
key: wireless
notify: reload wifi