Just copy paste with the computer clipboard and not with eyeballs and fingers
On Thu, 28 Jul 2022 at 18:53, boncalo mihai <[email protected]> wrote: > Not working unfortunately..: > > TASK [cephprep : Print facts] > ************************************************************************************************************************************************************************************ > task path: /git/cephprep/tasks/keyprep.yml:19 > ok: [ha01] => { > "ansible_facts[\"nodename\"]": "ha01" > } > > TASK [cephprep : Set authorized key took from file] > ************************************************************************************************************************************************************** > task path: /git/cephprep/tasks/keyprep.yml:24 > fatal: [ha01]: FAILED! => {"msg": "template error while templating string: > unexpected '~'. String: {{ lookup('file', '/git/cephprep/files/' ~ ~ > '/root/.ssh/id_rsa.pub') }}"} > fatal: [ha02]: FAILED! => {"msg": "template error while templating string: > unexpected '~'. String: {{ lookup('file', '/git/cephprep/files/' ~ ~ > '/root/.ssh/id_rsa.pub') }}"} > fatal: [ha03]: FAILED! => {"msg": "template error while templating string: > unexpected '~'. String: {{ lookup('file', '/git/cephprep/files/' ~ ~ > '/root/.ssh/id_rsa.pub') }}"} > > On Thu, Jul 28, 2022 at 7:39 PM Dick Visser <[email protected]> wrote: > >> You can't stack moustaches >> >> On Thu, 28 Jul 2022 at 17:43, boncalo mihai <[email protected]> wrote: >> >>> I have a task with run_once:true , which must run only on the first host >>> and I need to use that hostname into a lookup file , something like this: >>> >>> - >>> >>> >>> * name: Print facts debug: var: ansible_nodename register: >>> admin_host* >>> >>> >>> >>> >>> >>> >>> >>> *- name: Set authorized key took from file become: yes >>> authorized_key: user: root state: present key: "{{ lookup('file', >>> '/git/cephprep/files/{{ admin_host }}/root/.ssh/id_rsa.pub') }}"* >>> >> >> Try: >> >> * key: "{{ lookup('file', '/git/cephprep/files/' ~ admin_host ~ >> '/root/.ssh/id_rsa.pub') }}"* >> >> >> >> -- >> Sent from Gmail Mobile >> >> -- >> 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/CAF8BbLaxe7Le-2Be1waxmzt%2BkSG38aMaduC1_5VAEU%2BPhRXVsA%40mail.gmail.com >> <https://groups.google.com/d/msgid/ansible-project/CAF8BbLaxe7Le-2Be1waxmzt%2BkSG38aMaduC1_5VAEU%2BPhRXVsA%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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/CAOK917QcWPq1GiNpCtVzFx1Vd7zX_rhjTCqLmoSmfkYDr7ZXfA%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAOK917QcWPq1GiNpCtVzFx1Vd7zX_rhjTCqLmoSmfkYDr7ZXfA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- Sent from Gmail Mobile -- 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/CAF8BbLYxRtKeh9Ckrwu1o6CJ_HJ47d6aKtrnoLD6_2mpk4073Q%40mail.gmail.com.
