I’m a newbie to ansible and I’m using a very simple command.
ansible -i "client1," all -u mainteneur -b -K -m shell -a "whoami"
but I’d like to don’t use the switches -u and -K, so I don’t have to type the password.
If I use ansible.cfg, it’s work but the password is not the same on all my clients.
[su_become_plugin]
user = root
executable = su
password = 'MyPass'
How to I use host’s variable for ansible_ssh_user (-u) and ansible_become_password (-K) in configuration’s file?
Here my inventory’s file :
all:
children:
linux:
children:
web:
hosts:
client1:
vars:
var1: "apache2"
ansible_ssh_user: "mainteneur"
ansible_become_password: "MyPass"
db:
hosts:
client2:
var1: "mariadb"
What am I doing wrong ?