ansible/roles/switch-ports/tasks/main.yml

48 lines
1.5 KiB
YAML

---
- name: Configure ports
switch_config:
username: "{{ switch_vars.username }}"
password: "{{ switch_vars.password }}"
port: "{{ switch_vars.port }}"
host: "{{ switch_vars.host }}"
use_proxy: "{{ switch.use_proxy }}"
config:
path: ports
subpath:
- path: "{{ item.id }}"
data:
name: "{{ item.name }}"
is_port_enabled: "{{ item.enabled | default(true) }}"
loop: "{{ switch_vars.ports }}"
- name: Configure lldp
switch_config:
username: "{{ switch_vars.username }}"
password: "{{ switch_vars.password }}"
port: "{{ switch_vars.port }}"
host: "{{ switch_vars.host }}"
use_proxy: "{{ switch.use_proxy }}"
config:
path: lldp/local-port
subpath:
- path: "{{ item.id }}"
data:
port_id: "{{ item.id | string }}"
admin_status: "{{ 'LPAS_TX_AND_RX' if item.lldp is defined and item.lldp else 'LPAS_DISABLED' }}"
loop: "{{ switch_vars.ports }}"
- name: Configure loop-protect
switch_config:
username: "{{ switch_vars.username }}"
password: "{{ switch_vars.password }}"
port: "{{ switch_vars.port }}"
host: "{{ switch_vars.host }}"
use_proxy: "{{ switch.use_proxy }}"
version: v8
config:
path: "loop_protect/ports/{{ item.id }}"
data:
port_id: "{{ item.id | string }}"
is_loop_protection_enabled: "{{ item.loop_protect | default(False) }}"
loop: "{{ switch_vars.ports }}"
...