diff --git a/roles/access/tasks/main.yml b/roles/access/tasks/main.yml index 4813ea5..3e82132 100644 --- a/roles/access/tasks/main.yml +++ b/roles/access/tasks/main.yml @@ -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: