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
172 stars 97 forks source link

Inventory: not having access to a subcompartment breaks fetch of all other subcompartments #104

Closed sandorkazi closed 3 years ago

sandorkazi commented 3 years ago

Issue Report

Describe the issue

We have a compartment in all our tenancies named ManagedCompartmentForPaas which we cannot access. Hence the inventory plugin fails when trying to fetch all subcompartments.

Expected behavior

I'd expect some method to either only warning on this one or provide a parameter to explicitly exclude a compartment when fetching subcompartments.

Environment

Darwin Kazis-MacBook-Pro.local 19.6.0 Darwin Kernel Version 19.6.0: Tue Jun 22 19:49:55 PDT 2021; root:xnu-6153.141.35~1/RELEASE_X86_64 x86_64
ansible [core 2.11.4] 
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/Users/skazi/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
  ansible collection location = /Users/skazi/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.8.10 (default, May  4 2021, 03:05:50) [Clang 12.0.0 (clang-1200.0.32.29)]
  jinja version = 2.11.2
  libyaml = True
2.44.1
# /Users/skazi/.ansible/collections/ansible_collections
Collection Version
---------- -------
oracle.oci 2.29.0 

# /usr/local/lib/python3.8/site-packages/ansible_collections
Collection                    Version
----------------------------- -------
amazon.aws                    1.5.0  
ansible.netcommon             2.3.0  
ansible.posix                 1.2.0  
ansible.utils                 2.3.1  
ansible.windows               1.7.2  
arista.eos                    2.2.0  
awx.awx                       19.2.2 
azure.azcollection            1.8.0  
check_point.mgmt              2.0.0  
chocolatey.chocolatey         1.1.0  
cisco.aci                     2.0.0  
cisco.asa                     2.0.2  
cisco.intersight              1.0.16 
cisco.ios                     2.3.1  
cisco.iosxr                   2.4.0  
cisco.meraki                  2.4.2  
cisco.mso                     1.2.0  
cisco.nso                     1.0.3  
cisco.nxos                    2.5.0  
cisco.ucs                     1.6.0  
cloudscale_ch.cloud           2.2.0  
community.aws                 1.5.0  
community.azure               1.0.0  
community.crypto              1.8.0  
community.digitalocean        1.8.0  
community.docker              1.9.0  
community.fortios             1.0.0  
community.general             3.5.0  
community.google              1.0.0  
community.grafana             1.2.1  
community.hashi_vault         1.3.2  
community.hrobot              1.1.1  
community.kubernetes          1.2.1  
community.kubevirt            1.0.0  
community.libvirt             1.0.2  
community.mongodb             1.3.0  
community.mysql               2.1.0  
community.network             3.0.0  
community.okd                 1.1.2  
community.postgresql          1.4.0  
community.proxysql            1.1.0  
community.rabbitmq            1.1.0  
community.routeros            1.2.0  
community.skydive             1.0.0  
community.sops                1.1.0  
community.vmware              1.12.0 
community.windows             1.6.0  
community.zabbix              1.4.0  
containers.podman             1.6.2  
cyberark.conjur               1.1.0  
cyberark.pas                  1.0.7  
dellemc.enterprise_sonic      1.1.0  
dellemc.openmanage            3.6.0  
dellemc.os10                  1.1.1  
dellemc.os6                   1.0.7  
dellemc.os9                   1.0.4  
f5networks.f5_modules         1.11.0 
fortinet.fortimanager         2.1.3  
fortinet.fortios              2.1.2  
frr.frr                       1.0.3  
gluster.gluster               1.0.1  
google.cloud                  1.0.2  
hetzner.hcloud                1.4.4  
hpe.nimble                    1.1.3  
ibm.qradar                    1.0.3  
infinidat.infinibox           1.2.4  
inspur.sm                     1.2.0  
junipernetworks.junos         2.4.0  
kubernetes.core               1.2.1  
mellanox.onyx                 1.0.0  
netapp.aws                    21.6.0 
netapp.azure                  21.8.1 
netapp.cloudmanager           21.9.0 
netapp.elementsw              21.6.1 
netapp.ontap                  21.9.0 
netapp.um_info                21.7.0 
netapp_eseries.santricity     1.2.13 
netbox.netbox                 3.1.1  
ngine_io.cloudstack           2.1.0  
ngine_io.exoscale             1.0.0  
ngine_io.vultr                1.1.0  
openstack.cloud               1.5.0  
openvswitch.openvswitch       2.0.0  
ovirt.ovirt                   1.5.4  
purestorage.flasharray        1.10.0 
purestorage.flashblade        1.6.0  
sensu.sensu_go                1.11.1 
servicenow.servicenow         1.0.6  
splunk.es                     1.0.2  
t_systems_mms.icinga_director 1.20.0 
theforeman.foreman            2.1.2  
vyos.vyos                     2.5.0  
wti.remote                    1.0.1  

Ansible playbook to reproduce the issue

Can't provide such a playbook as this would require a subcompartment which you lack access to, not a playbook.

sandorkazi commented 3 years ago

I have a branch where I introduced a skip_subcompartment atttribute which can be provided for any compartment listed. May I provide that as a solution?

dineshsuthar786 commented 3 years ago

@sandorkazi , Thanks for creating the issue. We will create internal ticket to track the issue and will update it here.

bsushant-athena commented 3 years ago

@sandorkazi If your solution is ready then please raise a PR we will review.

sandorkazi commented 3 years ago

@bsushant-athena

I probably need something extra to be able to create a branch.

❯     git push --set-upstream origin skip_subcompartments

ERROR: Permission to oracle/oci-ansible-collection.git denied to sandorkazi.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Requested access to Oracle Contributor Agreement in OIM in the meantime... is that enough?

sagar2938 commented 3 years ago

We have created an internal issue and working on this. We will update you once the release the resolution for this issue

sagar2938 commented 3 years ago

option to exclude compartment has been added in the latest release v2.33.0 . To install the latest version run : ansible-galaxy collection install oracle.oci --force

changelog of the version release v2.33.0 : https://github.com/oracle/oci-ansible-collection/blob/master/CHANGELOG.md

Closing this issue.