Rozdělení do skupin DSA a swconfig, úprava role network
This commit is contained in:
31
roles/network/tasks/swconfig.yml
Normal file
31
roles/network/tasks/swconfig.yml
Normal 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"
|
||||
Reference in New Issue
Block a user