network/roles/access/tasks/main.yml

12 lines
611 B
YAML
Raw Normal View History

- name: Get switch password
set_fact:
ansible_ssh_pass: '{{ lookup("passwordstore", "switch/"~inventory_hostname, subkey="pass") }}'
2023-12-18 10:22:14 +00:00
- name: Set configuration
ansible.netcommon.cli_config:
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.
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