So what specifically would you say your problem is?
And perhaps it might be easier to just write a for loop and use ssh-copy-id to get your key up there first?
Ansible can do it, but there a few things to consider:
Do all hosts use the same password? If so then this is easy
If hosts use different passwords, you could temporarily put your password on your inventory
What is the need for interactivity? Ansible doesn’t typically do interactive remote tasks
Also for doing it serially you can use -f
Do you have to add your key to the root users authorized keys? I’d recommend not doing that, and just ssh as your user and use su or sudo functionality in ansible
So what specifically would you say your problem is?
I need to bulk add all host keys, then I need to add my SSH key on all the boxes.
And perhaps it might be easier to just write a for loop and use ssh-copy-id to get your key up there first?
I mean I can but Ansible should be able to do it I think. Might be wrong though.
Ansible can do it, but there a few things to consider:
Do all hosts use the same password? If so then this is easy
If hosts use different passwords, you could temporarily put your password on your inventory
ah. yes. I’ll probably do that. … then back it out.
What is the need for interactivity? Ansible doesn’t typically do interactive remote tasks
because OpenSSH will, by itself, prompt for the password, and add the host key.
Also for doing it serially you can use -f
Do you have to add your key to the root users authorized keys? I’d recommend not doing that, and just ssh as your user and use su or sudo functionality in ansible
Maybe but I find it’s effectively the same and would require some refactoring… but if I’m just going to SSH in and then immediately su it’s orthogonal.