Generate SSH keys with Ansible
If you need to generate SSH keys for your root user (or any other user) with Ansible, the following does the trick:
- name: Generate SSH keys
shell: ssh-keygen -b 2048 -t rsa -f /root/.ssh/id_rsa -q -N ""
args:
creates: /root/.ssh/id_rsa
Written by Bruno
Related protips
2 Responses
Why /root/ ?
over 1 year ago
·
How about using user
-module and generate_ssh_key
?
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Devops
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#