access: get switch username from password store

This commit is contained in:
Timotej Lazar 2024-10-02 10:39:12 +02:00
parent a230697846
commit e51d08c073

View file

@ -1,6 +1,11 @@
- name: Get switch password - name: Fetch passwords
set_fact: set_fact:
ansible_ssh_pass: '{{ lookup("passwordstore", "switch/"~inventory_hostname, subkey="pass") }}' password: '{{ lookup("passwordstore", "switch/"~inventory_hostname, returnall=true, missing="empty") | from_yaml }}'
- name: Set username and password for ansible connection
set_fact:
ansible_ssh_user: '{{ password.user }}'
ansible_ssh_pass: '{{ password.pass }}'
- name: Set configuration - name: Set configuration
ansible.netcommon.cli_config: ansible.netcommon.cli_config: