oracle / oci-ansible-collection

Oracle Cloud Infrastructure Ansible Collection provides an easy way to provision and manage resources in Oracle Cloud using Ansible.
https://docs.cloud.oracle.com/iaas/Content/API/SDKDocs/ansible.htm
Other
173 stars 97 forks source link

oci python sdk required for this module (SDK already installed) #267

Open lucasaugustomcc opened 10 months ago

lucasaugustomcc commented 10 months ago

Issue Report

Describe the issue

Even though the SDK is already installed I'm still getting an error message. I've followed the instructions from the Troubleshooting guide but it does not work for me.

Error message:

[I am not able to run a](fatal: [chat-52]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"}, "changed": false, "msg": "oci python sdk required for this module.", "troubleshooting_tips": "Refer to troubleshooting guide https://docs.oracle.com/en-us/iaas/tools/oci-ansible-collection/latest/guides/troubleshooting-guide.html"})

Expected behavior

Identify oci python sdk already installed and run playbook.

Environment

  ansible [core 2.16.2]
  config file = /home/lucas/.ansible.cfg
  configured module search path = ['/home/lucas/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.10/dist-packages/ansible
  ansible collection location = /home/lucas/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/usr/bin/python3)
  jinja version = 3.0.3
  libyaml = True

Ansible playbook to reproduce the issue

- name: Instances
  hosts: oracle
  strategy: free
  gather_facts: false
  collections:
    - oracle.oci
  tasks:    
  - name: Upgrade / downgrade compute instance
    oci_compute_instance:
      instance_id: "{{ instance_id }}"
      shape_config:
        memory_in_gbs: "{{ memory_in_gbs }}"
        ocpus: "{{ ocpus }}" 
        baseline_ocpu_utilization: BASELINE_1_1    
      wait_timeout: 3000
valkiriaaquatica commented 8 months ago

hey @lucasaugustomcc some recommendations:

  1. try to simulate the issue with a virtual enviroment

  2. Add pythn interpreter path to vars in playbooks

    vars:
    ansible_python_interpreter: /usr/bin/python3   

    you can try with python3.10 that ansible --version shows is using (in case you python 3 version is another parallel python version you have)

  3. Double check that python3 version has the oci installed: `/usr/bin/python3 -m pipshow oci and/usr/bin/python3 -m install show oci ` # in case is not