yeah ..but he wants multiple keys to be shipped at once. so the solution is to keep everything as it is and replace *with_key* with *with_file*
Regards. Le samedi 23 octobre 2021 à 08:03:18 UTC+2, [email protected] a écrit : > On Sat, 23 Oct 2021 at 00:49, Ndricim Danaj <[email protected]> wrote: > >> TASK [Set up multiple authorized ssh] >> ****************************************** >> fatal: [web1]: FAILED! => {"msg": "The task includes an option with an >> undefined variable. The error was: 'item' is undefined\n\nThe error appears >> to be in '/home/ndricim/playbooks/00.yml': line 5, column 9, but may\nbe >> elsewhere in the file depending on the exact syntax problem.\n\nThe >> offending line appears to be:\n\n tasks:\n >> >> --- >> - name: Set SSH Key >> hosts: web1 >> tasks: >> - name: Set up multiple authorized ssh >> authorized_key: >> user: work >> state: present >> key: '{{ item }}' >> with_key: >> - /home/ndricim/test/id_rsa2.pub >> - /home/ndricim/test/id_rsa3.pub >> > > > The keys are expected to be strings, not paths. > Use lookup for that. See > > https://docs.ansible.com/ansible/latest/collections/ansible/posix/authorized_key_module.html#examples > > > >> -- >> 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/09e4f6f5-0cde-4828-a82f-d2d618ad29d0n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/ansible-project/09e4f6f5-0cde-4828-a82f-d2d618ad29d0n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > Sent from a mobile device - please excuse the brevity, spelling and > punctuation. > -- 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/792cc839-1f03-4bc3-9cea-491be8095b9dn%40googlegroups.com.
