I think i know the problem now.
I started the playbook with at least 3 Hosts, but the log still shows one and everywhere âlocalhostâ
I thing in my playbook i should use instead of localhost all
Your playbook only contains debug task, so it does almost nothing; just displaying converted new key content.
The playbook that @shertel provided is just an example that shows the way to convert keys. You should update your playbook to use new_key_content variable as the key for ansible.posix.authorized_key.
Thank you!
So it seems that you can optionalls set the variables in the playbook before you execute the main task.
te fritst try failed the user ârottâ didnt exist
at least something happen - i cant login via ssh as usual with my public key.
The authorized_keys in root is no change, but i cant use the public keys for login even after restarting the ssh service
My example is to add key for the user charlie. Have you modified the user in my example correctly?
If yes, are you sure that your playbook indeed ran to the hosts you are trying to connect to via SSH, by the hostname or IP address that appears in the playbook logs?
Uh yes i used root - i think for the future i should use a dedicated user.
The public ssh login is no problem - my mount left me with my keys and i thought the remote desktop manager would store them.
How can i recognize that the key has been entered- will there be another line with the key?
Iâm not sure I understand your question. Could you please clarify your goal?
The /root/.ssh/authorized_keys for the hosts 192.168.151.237 and 192.168.19.201 should have been updated to include the line ssh-rsa AAAAB3NzaC1yc... since your logs show the task as changed.
If this is true, itâs a bug that should be reported on GitHub, but I canât reproduce it at all, at least in my environment. It works as expected with or without the path on my side.
I recommend you to know basic playbook syntax and variable usage, then try it.
If you open an issue at Issues ¡ ansible-collections/ansible.posix ¡ GitHub please be sure to include a simple generic reproducer, the full output with -vvv, and the commands youâre running that prove the module didnât do what it claimed. I wasnât able to reproduce the issue.
The syntax of your latest code block isnât right, but reading the docs and trying it (and reading the error messages) is a good way to learn.
I used two Templates one with the correct behaviour and path added and one with the path not set and nothing happens and uploaded anr linked them in the issue.