Skip to content
This repository was archived by the owner on Sep 28, 2024. It is now read-only.

Commit adb1686

Browse files
author
root
committed
breaking change: change var names in network role
openwrt_network_devices: -> openwrt_network_deviceshost -> openwrt_network_devicesgroup openwrt_network_interfaces -> openwrt_network_interfaceshost -> openwrt_network_interfacesgroup now it is possible to define interfaces and devices in the networking role also on a host and/or group basis in ansible It's the same as this is already been done before in the openwrt_network_firewall role This was necessary when having bigger environments where interfaces and devices are the same on lots of devices. Docs will be changed, too soon.
1 parent 43112c7 commit adb1686

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

roles/ansible_openwrtnetwork/tasks/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
# tasks file for ansible_openwrtnetwork
3+
- name: merge interfaces from group and host definitions
4+
include_tasks: merge.yml
35
# Wireguard
46
- name: make sure wireguard management dir exists
57
ansible.builtin.file:
@@ -20,6 +22,7 @@
2022
ansible.builtin.file:
2123
path: "{{ openwrt_network_deploypath }}"
2224
state: directory
25+
# Main Network Deployment Tasks
2326
- name: Deploy Network configuration
2427
ansible.builtin.template:
2528
src: network.jinja2
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Merge Interfaces
2+
- name: merge group interfaces
3+
set_fact:
4+
openwrt_network_interfacesmergedgroup: "{{ openwrt_network_interfacesgroup.keys() | list | intersect(group_names) | map('extract', openwrt_network_interfacesgroup) | combine }}"
5+
when: openwrt_network_interfacesgroup is defined
6+
- name: combine all interfaces into openwrt_network_interfaces
7+
set_fact:
8+
openwrt_network_interfaces: "{{ openwrt_network_interfaceshost | default({}) | combine(openwrt_network_interfacesmergedgroup | default({}) ) }}"
9+
# Merge Devices
10+
- name: merge group devices
11+
set_fact:
12+
openwrt_network_devicesmergedgroup: "{{ openwrt_network_devicesgroup.keys() | list | intersect(group_names) | map('extract', openwrt_network_devicesgroup) | combine }}"
13+
when: openwrt_network_devicesgroup is defined
14+
- name: combine all devices into openwrt_network_devices
15+
set_fact:
16+
openwrt_network_devices: "{{ openwrt_network_deviceshost | default({}) | combine(openwrt_network_devicesmergedgroup | default({}) ) }}"

0 commit comments

Comments
 (0)