Closed sluetze closed 3 years ago
I digged into this a little deeper.
lookup('ENV' 'HOME')
does a lookup on the ENV on the CONTROLLER.
The docs state:
Allows you to query the environment variables available on the controller when you invoked Ansible.
Since my ansible_user (ansible) is not equal to my local user, the error is thrown
I think there are two possible solutions
delegate_to: localhost
could be sufficient. I'm not sure if this fixes it completely.I'll file a PR for Solution 2
Hi, I'm trying to use the role to setup kvm + some vms (as it is intended). I'm using a REMOTE Host as target which is connected by a user "ansible", while i am logged in as user "USER"
Add Host to SSH config fails
this permission issue is for
roles/ansible-role-virt-infra/tasks/wait.yml
(ssh-fingerprint) androles/ansible-role-virt-infra/tasks/hosts_add.yml
(ssh-key addition)This seems to be fixable easily by changing
become: false
tobecome: true
for the add host task. while this is easy for me i am not quite sure if the result is wanted, or if the lookup has to be changed to use the "ansible_user" and the homedir of that user.while adding the key to the known hosts, the owner also must get set.