- 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 }}" 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) }}" 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