I still keep geting this error

fatal: [localhost]: FAILED! => {"msg": "An unhandled exception occurred 
while templating '{{ lookup('file', '/home/rke/.ssh/id_rsa.pub')}}'. Error 
was a <class 'ansible.errors.AnsibleError'>, original message: 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/rke/.ssh/id_rsa.pub"}

The file does exist but the user running the task dont have access. So I 
used become: root
and become_method: sudo

but still dont work

---
- hosts: localhost
  gather_facts: false
  vars:
    filecon: "{{ lookup('file', '/home/rke/.ssh/id_rsa.pub')}}"
  tasks:
  - debug: 
      msg: "the value of foo.txt is: {{ filecon }}"
    become_user: root
    become_method: sudo

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/229d32d7-8619-4fd4-b82c-2d41d611ee72n%40googlegroups.com.

Reply via email to