Skip to content

Latest commit

 

History

History
51 lines (41 loc) · 2.41 KB

InstallationGuide.md

File metadata and controls

51 lines (41 loc) · 2.41 KB

Installing the Collection with yum

You can use yum to install the Oracle Cloud Infrastructure Ansible Module Collection RPM.

The RPM also installs the required dependencies: the OCI SDK for Python and Ansible.

The following example shows how to use yum to install the Ansible Module Collection RPM:

$ yum -y install oraclelinux-developer-release-el7 && sudo yum install oci-ansible-collection

Note: This installation uses Python version 3.6.

To test the installation of the RPM and configuration of the SDK, you can run a sample playbook. For example:

$ ansible-playbook-3 /usr/share/doc/oci-ansible-collection-<version>/samples/object_storage/get_namespace/sample.yaml

Manual Installation Steps:

    sudo pip3 install virtualenv
    virtualenv venvansible
    source venvansible/bin/activate
    pip3 install oci
    pip3 install ansible
    ansible-galaxy collection install -f oracle.oci

To test the installation, you can run this sample:

venvansible/bin/ansible-playbook -vvv ~/.ansible/collections/ansible_collections/oracle/oci/samples/object_storage/get_namespace/sample.yaml

How to troubleshoot installation errors?

Troubleshoot the error oci python sdk required for this module

You will get an error if Ansible runs using python2 and the python SDK is installed under python 3.
The above installation should run python from the virtual env path: venvansible/bin/python.
You should see this in the logs when running the playbook using -vvv flag: venvansible/bin/python /Users/.ansible/tmp/ansible-tmp/AnsiballZ_setup.py
Make sure Ansible is not using /usr/bin/python when running: /usr/bin/python /Users/.ansible/tmp/ansible-tmp/AnsiballZ_setup.py
Refer to Ansible python 3 support: https://docs.ansible.com/ansible/2.4/python_3_support.html

Note: Ansible only uses the current python environment if you are using the implicit localhost i.e if you use the host as localhost and do not define any host configuration. Else it goes through the interpreter discovery process 'and picks the first one. It provides a configuration setting (both at system level and the host level) to explicitly set the python interpreter to use.
Please check https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html. Please set it to the environment (path to python executable) where OCI python SDK is installed and re-run the playbook.