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/22bd52d7-2934-42d7-ae6a-9c2ca74be58b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.