Hi. I am trying to set up an environment using different passwords for different hosts:
In ./group_vars/all I have the line:
ansible_sudo_pass: “{{ lookup(‘password’, ‘passwords/’ + inventory_hostname) }}”
#ansible_sudo_pass:
(basically stolen from this page: http://serverfault.com/questions/560106/how-can-i-implement-ansible-with-per-host-passwords-securely)
And the corresponding password files exist.
My testing playbook is:
- hosts: all
sudo: no
tasks:- name: Some name
debug: msg=“!{{ ansible_sudo_pass }}!.”
It works with sudo set to “no” and outputs the correct password strings for each host.
If I set sudo to “yes” I get:
fatal: [] => Incorrect sudo password
for each host
If I uncomment out the second line in group_vars/all then it works (for the host with that password, which is all of them while I test)
What am I doing wrong here?