ansible/roles/switch-system/tasks/main.yml
2025-09-30 20:16:26 +02:00

67 lines
2.2 KiB
YAML

---
- name: Configure switch
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: system
data:
name: "{{ switch_vars.name | default('') }}"
location: "{{ switch_vars.location | default('') }}"
contact: "{{ switch_vars.contact | default('')}}"
- name: Configure sntp
switch_config:
username: "{{ switch_vars.username }}"
password: "{{ switch_vars.password }}"
port: "{{ switch_vars.port }}"
host: "{{ switch_vars.host }}"
use_proxy: "{{ switch.use_proxy }}"
version: v7
config:
path: system/sntp
data:
sntp_client_operation_mode: "{{ glob_switch.sntp.operation_mode }}"
sntp_config_poll_interval: "{{ glob_switch.sntp.poll_interval }}"
- name: Configure sntp servers
switch_config:
username: "{{ switch_vars.username }}"
password: "{{ switch_vars.password }}"
port: "{{ switch_vars.port }}"
host: "{{ switch_vars.host }}"
use_proxy: "{{ switch.use_proxy }}"
version: v7
config:
path: system/sntp_server
create_method: POST
subpath:
path: "{{ item.priority }}-{{ item.ip }}"
delete: "{{ item.delete | default(False) }}"
data:
sntp_servers:
- sntp_server_address:
version: "{{ item.ip_version | default('IAV_IP_V4') }}"
octets: "{{ item.ip }}"
sntp_server_priority: "{{ item.priority }}"
sntp_server_version: "{{ item.version | default(4) }}"
sntp_server_is_oobm: "{{ item.is_oobm | default(None) }}"
loop: "{{ glob_switch.sntp.servers }}"
- 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: v7
config:
path: loop_protect
data:
port_disable_timer_in_seconds: "{{ glob_switch.loop_protect.port_disable_timer_in_seconds }}"
transmit_interval_in_seconds: "{{ glob_switch.loop_protect.transmit_interval_in_seconds }}"
...