I have a task like this

- name: test
>   tags: key
>   authorized_key:
>     user: "{{ item }}"
>     state: present
>     key: "{{lookup('file', '/home/{{ item }}/.ssh/id_rsa.pub')}}"          
>                                                        
>   with_items:
>     - changch
>   become_user: "{{ item }}"



 I'm sure the id_rsa.pub exists in local ansible controller (actually, the 
file exists on both node )

[minion@hqs009 ansiblecontrol]$ sudo ls -lart /home/changch/.ssh/id_rsa.pub
> -rw------- 1 changch root 757 Mar 23  2018 /home/changch/.ssh/id_rsa.pub
> [minion@hqs009 ansiblecontrol]$ 


but there are some error messages like this
 

task path: 
/home/mini/D/ansiblecontrol/roles/bootstrap-1804/tasks/main.yml:113
Tuesday 31 December 2019  09:01:40 +0800 (0:00:04.004)       0:00:04.141 
****** 
[WARNING]: Unable to find '/home/changch/.ssh/id_rsa.pub' in expected paths 
(use -vvvvv to see paths)
File lookup using None as file
fatal: [hqdc075.abc.com]: FAILED! => {}
MSG:
An unhandled exception occurred while running the lookup plugin 'file'. 
Error was a <class 'ansible.errors.AnsibleError'>, original message: could 
not locate file in lookup: /home/changch/.ssh/id_rsa.pub

PLAY RECAP 
***********************************************************************************************************************
hqdc075.abc.com    : ok=1    changed=0    unreachable=0    failed=1    
skipped=0    rescued=0    ignored=0 


any advice and suggestions will be greatly appreciated 
<https://www.travellerspoint.com/forum.cfm?thread=14067>


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e81d7ab9-4909-4f55-95d1-48636182ce87%40googlegroups.com.

Reply via email to