Thank you! That explains why it wasn't working, I was using Python Shade 0.6.
I just filled a bug report on Launchpad to upgrade it to the latest stable Shade release. Upgrade to latest stable version 1.5.1 of Python Shade: https://bugs.launchpad.net/ubuntu/+source/python-shade/+bug/1555819 Right now, Ubuntu 16.04 have Shade 1.3.0, I'll give it another try, maybe it will work! Also, I'm already using OS_* variables via Ansible "environment" feature, that's how it works via "shell module" and I'll stick with it by now (i.e., I'm not going to use clouds.yaml file yet). Thanks again David! Thiago On Monday, February 29, 2016 at 2:26:30 PM UTC-3, David Shrewsbury wrote: > > Hi! > > You first need to upgrade your version of shade. The latest version is > 1.4.0. > > Second, you should not expect a clouds.yaml to be read from the current > directory because of the way Ansible works (copying modules to temp > directories > on the target host before running them). Instead, place it either in the > /etc/openstack directory, or in ~/.config/openstack (of the user running > the > task). > > Alternatively, you can just use the normal OS_ environment variables, but > you > should not mix use of env vars with clouds.yaml. > > -David > > > On Monday, February 29, 2016 at 11:05:21 AM UTC-5, Thiago Martins wrote: >> >> Hey guys! >> >> Ansible is AWESOME! :-D >> >> I'm planning to move away from running "shell:" via Ansible, in favor of >> native modules, but, it is not working, as follows... >> >> Can someone explain to me, why this task works: >> >> --- >> >> - name: ubuntu | uploading SSH Keypair into OpenStack >> environment: "{{ demo_openrc_env }}" >> shell: nova keypair-add --pub-key "/home/{{ubuntu_user}}/.ssh/id_rsa.pub" >> default >> >> --- >> >> And why this does NOT work: >> >> --- >> >> - name: ubuntu | uploading SSH Keypair into OpenStack >> environment: "{{ demo_openrc_env }}" >> os_keypair: >> state: present >> name: default >> public_key_file: "/home/{{ubuntu_user}}/.ssh/id_rsa.pub"--- >> >> --- >> ERROR: >> - >> TASK [os_user_key : ubuntu | uploading SSH Keypair into OpenStack] >> ************* >> An exception occurred during task execution. To see the full traceback, use >> -vvv. The error was: AttributeError: 'OpenStackCloud' object has no >> attribute 'get_keypair' >> fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "parsed": >> false} >> >> --- >> >> What am I missing? Appending "-vvv" doesn't help either... >> >> I also tried to use the "clouds:" entry of "os_keypair" but, also, >> doesn't work... It doesn't find "mycloud", even if clouds.yml is there on >> same dir of task... So, I'll prefer for now, to use "environment:", if >> possible... >> >> Any clues? >> >> Thanks in advance! >> >> Best, >> Thiago >> > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/42ec8466-5f0d-4283-bfc0-7331ed168789%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
