tried this way and got same error

- name: Setup authkeys for user rke
  authorized_key:
    user: '{{ username }}'
    state: present
    key: "{{ lookup(‘file’, '/home/{{ username }}/.ssh/id_rsa.pub') }}"



On Wed, Jul 20, 2022 at 2:12 PM Tony Wong <tdubb...@gmail.com> wrote:

> can i use jinja like this?
>
> - name: Setup authkeys for user rke
>   authorized_key:
>     user: rke
>     state: present
>     key: “{{ lookup(‘file’, ‘{{ authorized_key }}’) }}”
>
>
>
> keep getting error
>
>
> Setup authkeys for user rke] *******************************************
> fatal: [k8master]: FAILED! => {"msg": "template error while templating
> string: unexpected char '‘' at 11. String: “{{ lookup(‘file’, ‘{{
> authorized_key }}’) }}”"}
> fatal: [k8node02]: FAILED! => {"msg": "template error while templating
> string: unexpected char '‘' at 11. String: “{{ lookup(‘file’, ‘{{
> authorized_key }}’) }}”"}
> fatal: [k8node01]: FAILED! => {"msg": "template error while templating
> string: unexpected char '‘' at 11. String: “{{ lookup(‘file’, ‘{{
> authorized_key }}’) }}”"}
>
>
>
> On Wed, Jul 20, 2022 at 10:31 AM boncalo mihai <mbonc...@gmail.com> wrote:
>
>> Just did that, you use authorized_key module
>>
>> On Wed, Jul 20, 2022 at 4:24 PM Tony Wong <tdubb...@gmail.com> wrote:
>>
>>> how do I lookup id_rsa.pub on a host and then run ansible playbook to
>>> copy it to their authorized_key file?
>>>
>>>
>>> --
>>> 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/2994746b-812f-4038-ad58-27d5b0c47been%40googlegroups.com
>>> <https://groups.google.com/d/msgid/ansible-project/2994746b-812f-4038-ad58-27d5b0c47been%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Ansible Project" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/ansible-project/gkaigHAiAC0/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, 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/CAOK917Sv42GhE_GR3yo5vxSrYjB9bs-8bHsn9%2BA-4O5tcLNaDA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAOK917Sv42GhE_GR3yo5vxSrYjB9bs-8bHsn9%2BA-4O5tcLNaDA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/CALmkhkpW-8t71j%3DQ%2BWjMS60oyP%3D%3Dm%3DpR9b_%3Dx4pNekr2T86xew%40mail.gmail.com.

Reply via email to