This was a pre-21.02 thing. We will instead configure a device for the network.interface to point to.
76 lines
2.6 KiB
YAML
76 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 }}"
|
|
ifname: "{{ item.ifname | default() }}"
|
|
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
|