Ansible + passwordstore: Creating, storing and distributing SSH key pairs

There are many situations where you need or want to use SSH keys for connecting to a server. This could be automatic software deployment (continuous deployment) or backup.

I was looking for a way to create, securely store and distribute the necessary keys to my server for both deployment and backup purposes. I was already using Ansible for setup up my servers. So it was obvious to use it for the SSH keys too. My goal was to

only by running a playbook.

I created a gist with the solution I came up with.