access: get switch username from password store
This commit is contained in:
parent
a230697846
commit
e51d08c073
|
@ -1,6 +1,11 @@
|
|||
- name: Get switch password
|
||||
- name: Fetch passwords
|
||||
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
|
||||
ansible.netcommon.cli_config:
|
||||
|
|
Loading…
Reference in a new issue