Initial commit

This commit is contained in:
2024-10-30 01:50:38 +01:00
commit 587ca23374
147 changed files with 7521 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
---
# Set state status for network device
- name: Set state status for network device {{ item.id | default('@device[-1]') }}
ansible.builtin.set_fact:
network_device_state: "{{ item.state | default('present') }}"
# Delete network device
- name: Delete network device {{ item.id }}
when: "'absent' in network_device_state"
uci:
command: "absent"
config: "network"
section: "{{ item.id }}"
type: "device"
# Create and configure network device
- name: Create and configure network device
when: "'present' in network_device_state"
block:
# Create network device
- name: Create network device {{ item.id | default('@device[-1]') }}
uci:
command: "add"
config: "network"
section: "{{ item.id | default('@device[-1]') }}"
type: "device"
# Configure network device
- name: Configure network device {{ item.id | default('@device[-1]') }}
uci:
command: "set"
config: "network"
section: "{{ item.id | default('@device[-1]') }}"
type: "device"
value:
name: "{{ item.name | default(omit) }}"
type: "{{ item.type | default(omit) }}"
ports: "{{ item.ports | default([]) | join(' ') }}"
stp: "{{ item.stp | default(omit) }}"
vlan: "{{ item.vlan | default(omit) }}"
igmp_snooping: "{{ item.igmp_snooping | default(omit) }}"
ipv6: "{{ item.ipv6 | default(omit) }}"