Description of problem: I am setting up OpenStack instance configuration in Ansible manifest, so in case of failure, I can rebuild the instance. But one of the obstacle is that I could not (as admin) upload ssh keypair to users. Well there exist one trick I am aware of. But it is ugly and dirty. It would be nice if I can do something like nova keypair-add --tenant TENANT_ID --pub_key someuser_id_rsa.pub KEY_NAME This way I can easily restore OpenStack instance.
This seems like a request that should be filed upstream. If you are rebuilding the environment and re-adding users, it sounds as if you already have access to password credentials for the users. Given this information it should be relatively easy to automate the process of adding keys with ansible, something like: - name: create keypair command: > nova --os-username {{item.name}} --os-tenant-name {{user.tenant}} --os-auth-url {{os_auth_url}} --os-password {{user.password}} keypair_add --pub-key {{item.key}} {{item.name}} with_items: - name: alice key: keys/alice.key tenant: users password: secret - name: bob key: keys/bob.key tenant: users password: secret
Submitted as: https://bugs.launchpad.net/nova/+bug/1450454