network/roles/access/tasks/main.yml
Timotej Lazar c479f90669 access: move switch config templates back to this repo
Let’s keep it simple. Also editing templates in NetBox is a pain.
2024-04-08 14:45:39 +02:00

12 lines
611 B
YAML

- name: Get switch password
set_fact:
ansible_ssh_pass: '{{ lookup("passwordstore", "switch/"~inventory_hostname, subkey="pass") }}'
- name: Set configuration
ansible.netcommon.cli_config:
config: '{{ lookup("template", "config-"~manufacturer~"-"~device_type~".j2") }}'
register: result
# These lines are not displayed by 'sho ru' and always reported as different, so ignore them.
changed_when: result.commands | reject('match', '^(no shutdown|no switchport access vlan|switchport mode access|switchport mode hybrid|interface .*|no enable service web-server https?)$')
notify: write config