IBM-Cloud / ansible-collection-ibm

https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs
Mozilla Public License 2.0
70 stars 73 forks source link

error while evaluating conditional (pi_ssh_key_existing_output.rc != 0 #43

Open mad5bo opened 3 years ago

mad5bo commented 3 years ago

ansible-playbook create.yml -v

Using /home/QSECOFR/.ansible/collections/ansible_collections/ibm/cloudcollection/examples/simple-vm-power-vs/ansible.cfg as config file [WARNING]: No inventory was parsed, only implicit localhost is available [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [POWER VSI Creation Demo] **

TASK [Gathering Facts] ** ok: [localhost]

TASK [Check for existing SSH Key] *** fatal: [localhost]: FAILED! => {"msg": "The conditional check 'pi_ssh_key_existing_output.rc != 0' failed. The error was: error while evaluating conditional (pi_ssh_key_existing_output.rc != 0): 'dict object' has no attribute 'rc'"}

PLAY RECAP ** localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

the configuration file [local] localhost ansible_connection=local

ansible --version ansible 2.9.9 config file = /home/QSECOFR/.ansible/collections/ansible_collections/ibm/cloudcollection/examples/simple-vm-power-vs/ansible.cfg configured module search path = ['/HOME/QSECOFR/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /QOpenSys/pkgs/lib/python3.6/site-packages/ansible executable location = /QOpenSys/pkgs/bin/ansible python version = 3.6.12 (default, Nov 10 2020, 13:50:57) [GCC 6.3.0]

Another

ansible-playbook list_pi_images.yml -v

Using /home/QSECOFR/.ansible/collections/ansible_collections/ibm/cloudcollection/examples/simple-vm-power-vs/ansible.cfg as config file [WARNING]: No inventory was parsed, only implicit localhost is available [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [List Power Virtual Server Cloud Images] ***

TASK [Gathering Facts] ** ok: [localhost]

TASK [ibm_pi_images_info] *** fatal: [localhost]: FAILED! => {"changed": false, "msg": "missing required arguments: ibmcloud_api_key"}

PLAY RECAP ** localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

jaywcarman commented 3 years ago

Hi @mad5bo.

For your first issue, I think you will need PR #49. With that fix you could retrieve an existing SSH key using the ibm_pi_key_info module.

Your second issue seems to be that you need to set an ibmcloud_api_key value. You can do this using an env var in your shell, IC_API_KEY, or by setting ibmcloud_api_key directly in the module parameters.