Rozdělení do skupin DSA a swconfig, úprava role network

This commit is contained in:
2024-11-01 03:32:26 +01:00
parent 587ca23374
commit cde297bd2e
18 changed files with 201 additions and 268 deletions

View File

@@ -0,0 +1,31 @@
---
# Set state status for switch vlan
- name: Set state status for switch vlan {{ item.vlan }}
ansible.builtin.set_fact:
switch_vlan_state: "{{ item.state | default('present') }}"
# Delete switch vlan
- name: Delete switch vlan {{ item.vlan }}
when: "'absent' in switch_vlan_state"
uci:
command: "absent"
config: "network"
type: "switch_vlan"
find:
vlan: "{{ item.vlan | mandatory }}"
# Create and configure switch vlan
- name: Create and configure switch vlan
when: "'present' in switch_vlan_state"
uci:
command: "section"
config: "network"
type: "switch_vlan"
find:
vlan: "{{ item.vlan | mandatory }}"
value:
device: "{{ item.device | default('switch0') }}"
vid: "{{ item.vid | default(item.vlan | default(omit)) }}"
ports: "{{ item.ports | default([]) }}"
description: "{{ item.description | default(omit) }}"
replace: "yes"