On 03/06/2015 04:02 PM, Miroslav Suchý wrote:
I tried to automatize adding of SSH keys using this:
TASK: [shell source /root/keystonerc_admin && F=$(mktemp) && {{ lookup('pipe', '/srv/web/infra/ansible/scripts/auth-keys-from-fas msuchy') }}> "$F" && nova --os-username msuchy --os-password {{msuchy_password}} --os-tenant-name copr keypair-list | ( grep msuchy || nova --os-username msuchy --os-password {{msuchy_password}} --os-tenant-name copr keypair-add --pub_key "$F" msuchy ); rm -f "$F"] ***
which does not work. While executing this from shell:
source /root/keystonerc_admin && F=$(mktemp) && cat id_rsa.pub > "$F" && nova --os-username msuchy --os-password "$PASSWORD" --os-tenant-name copr keypair-list | ( grep msuchy || nova --os-username msuchy --os-password "$PASSWORD" --os-tenant-name copr keypair-add --pub_key "$F" msuchy ); rm -f "$F"
works. So probably problem is in that lookup() and again I do not know why.
Ok, I just find that there is ansible module for that. And it works fine.