Hello community,
I’ve written a playbook which looks like this:
main.yml:
- hosts: $hosts
user: root
roles: - add_ansible_user
- hosts: $hosts
user: ansible
sudo: yes
roles: - do_stuff2
I run this playbook like this:
ansible-playbook -e hosts=foobar -k
First part is working well. Second part is failing, because ansible still uses the password I set with -k and not the it’s ssh-key.
Is there a possibility to use -k option just for the first part of the playbook?
Any ideas?
Thanx in advance