2024-02-13 09:33:14 +00:00
|
|
|
- name: Get switch password
|
|
|
|
set_fact:
|
2024-04-05 10:00:22 +00:00
|
|
|
ansible_ssh_pass: '{{ lookup("passwordstore", "switch/"~inventory_hostname, subkey="pass") }}'
|
2024-02-13 09:33:14 +00:00
|
|
|
|
2023-12-18 10:22:14 +00:00
|
|
|
- name: Set configuration
|
|
|
|
ansible.netcommon.cli_config:
|
2024-04-08 08:48:10 +00:00
|
|
|
config: '{{ lookup("template", "config-"~manufacturer~"-"~device_type~".j2") }}'
|
2023-12-18 10:22:14 +00:00
|
|
|
register: result
|
|
|
|
# These lines are not displayed by 'sho ru' and always reported as different, so ignore them.
|
2024-03-04 09:12:38 +00:00
|
|
|
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?)$')
|
2023-12-18 10:22:14 +00:00
|
|
|
notify: write config
|