ssh management ansible

52 views
Skip to first unread message

Ndricim Danaj

unread,
Oct 22, 2021, 6:49:02 PM10/22/21
to Ansible Project
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

Alex Wanderley

unread,
Oct 22, 2021, 6:51:43 PM10/22/21
to ansible...@googlegroups.com
Hi,

"with_key:" should actually be "with_items"

Alex


--
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-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/09e4f6f5-0cde-4828-a82f-d2d618ad29d0n%40googlegroups.com.


--

 

Edmonton_sig_RGB_S.jpg

Alex Wanderley

Application and Infrastructure Analyst II
Acting Team Lead Storage and Backup Solutions

Financial and Corporate Services | Open City and Technology  

 

780-496-4156  Office

780-819-0273  Mobile

 

City of Edmonton

Century Place, 12th Floor

9803 102A Avenue NW

Edmonton AB, T5J 3A3

 

All information contained in this email post is proprietary to the City of Edmonton, confidential and intended only for the addressed recipient. If you have received this post in error, please disregard the contents, inform the sender of the misdirection, and remove it from your system. The copying, dissemination or distribution of this email, if misdirected, is strictly prohibited.


The contents of this message and any attachment(s) are confidential, proprietary to the City of Edmonton, and are intended only for the addressed recipient. If you have received this in error, please disregard the contents, inform the sender of the misdirection, and remove it from your system. The copying, dissemination, or distribution of this message, if misdirected, is strictly prohibited.

Dick Visser

unread,
Oct 23, 2021, 2:03:18 AM10/23/21
to ansible...@googlegroups.com
The keys are expected to be strings, not paths. 



--
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-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/09e4f6f5-0cde-4828-a82f-d2d618ad29d0n%40googlegroups.com.
--
Sent from a mobile device - please excuse the brevity, spelling and punctuation.

steve missoh

unread,
Oct 25, 2021, 8:31:43 PM10/25/21
to Ansible Project
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.

Dick Visser

unread,
Oct 26, 2021, 4:00:28 AM10/26/21
to ansible...@googlegroups.com
On Tue, 26 Oct 2021 at 02:31, steve missoh <stefim...@gmail.com> wrote:
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


--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT
Reply all
Reply to author
Forward
0 new messages