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