Skip to content

Commit 072b7a9

Browse files
author
Oracle Public Cloud User
committed
Releasing version 2.7.0
1 parent bc7f8f4 commit 072b7a9

File tree

207 files changed

+7986
-198
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

207 files changed

+7986
-198
lines changed

CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
55
This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [2.7.0] - 2020-9-10
8+
9+
### Added:
10+
- Added VMWare (ocvp) modules
11+
- Added Data Integration Workspace modules
12+
- Added multiple Database modules and features
13+
- Added Network modules, features and support for it
14+
- Added features for Budget service
15+
- Added multiple Identity modules and features
16+
- Added support for auto_backup_window in Database service
17+
18+
### Changed:
19+
- Please update to the latest version of OCI Python SDK (2.21.3).
20+
21+
### Fixes:
22+
- Removed the redirect to home region in these modules oci_identity_fault_domain_facts
23+
and oci_identity_availability_domain_facts.
24+
725
## [2.6.0] - 2020-8-27
826

927
### Added:

InstallationGuide.md

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
1-
## Installation Steps:
1+
### Installing the Collection with yum
2+
3+
You can use yum to install the Oracle Cloud Infrastructure Ansible Module Collection RPM.
4+
5+
The RPM also installs the required dependencies: the OCI SDK for Python and Ansible.
6+
7+
The following example shows how to use yum to install the Ansible Module Collection RPM:
8+
``` bash
9+
$ yum -y install oraclelinux-developer-release-el7 && sudo yum install oci-ansible-collection
10+
```
11+
Note:
12+
This installation uses Python version 3.6.
13+
14+
To test the installation of the RPM and configuration of the SDK, you can run a sample playbook. For example:
15+
``` bash
16+
$ ansible-playbook-3 /usr/share/doc/oci-ansible-collection-<version>/samples/object_storage/get_namespace/sample.yaml
17+
```
18+
19+
### Manual Installation Steps:
220
```
321
sudo pip3 install virtualenv
422
virtualenv venvansible
@@ -13,7 +31,7 @@ To test the installation, you can run this sample:
1331
venvansible/bin/ansible-playbook -vvv ~/.ansible/collections/ansible_collections/oracle/oci/samples/object_storage/get_namespace/sample.yaml
1432
```
1533

16-
## How to troubleshoot installation errors?
34+
### How to troubleshoot installation errors?
1735
#### Troubleshoot the error `oci python sdk required for this module`
1836

1937
You will get an error if Ansible runs using python2 and the python SDK is installed under python 3.<br/>

README.md

+24-3
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,30 @@ We have also added a new [User Guide](https://github.com/oracle/oci-ansible-coll
6363
- MySQL
6464
- Big Data
6565
- Usage
66+
- VMWare
67+
- Data Integration
6668

6769
## Installation
6870

69-
#### 1) Installing collections
71+
#### 1) Installing the Collection with yum
72+
73+
You can use yum to install the Oracle Cloud Infrastructure Ansible Module Collection RPM.
74+
75+
The RPM installs the OCI Ansible module collection and its required dependencies: the OCI SDK for Python and Ansible.
76+
77+
The following example shows how to use yum to install the Ansible Module Collection RPM:
78+
``` bash
79+
$ yum -y install oraclelinux-developer-release-el7 && sudo yum install oci-ansible-collection
80+
```
81+
Note:
82+
This installation uses Python version 3.6.
83+
84+
To test the installation of the RPM and configuration of the SDK, you can run a sample playbook. For example:
85+
``` bash
86+
$ ansible-playbook-3 /usr/share/doc/oci-ansible-collection-<version>/samples/object_storage/get_namespace/sample.yaml
87+
```
88+
89+
#### 2) Installing collections from Ansible Galaxy
7090

7191
You can install it from [Ansible Galaxy](https://galaxy.ansible.com/oracle) using the command:
7292
``` bash
@@ -77,7 +97,7 @@ Notes:
7797
* For more information about collections, please check [Ansible Collections](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html)
7898
* To update the modules to latest version, use the install --force flag.
7999

80-
#### 2) Install OCI Python SDK
100+
#### Install OCI Python SDK
81101

82102
The Oracle Cloud Ansible modules are built using the [Oracle Cloud Infrastructure Python SDK](https://docs.us-phoenix-1.oraclecloud.com/Content/API/SDKDocs/pythonsdk.htm).
83103

@@ -100,7 +120,8 @@ with Oracle Cloud Infrastructure services under [the samples directory on GitHub
100120
Begin by reviewing the Readme.md file that you will find in each sample's root directory.
101121

102122
## Documentation
103-
Module documentation is found [here](https://github.com/oracle/oci-ansible-collection/tree/master/docs)<br/>
123+
Module documentation is found [here](https://github.com/oracle/oci-ansible-collection/tree/master/docs). The HTML version is available on [readthedocs.io](https://oci-ansible-collection.readthedocs.io/en/latest/).
124+
104125
To view the module documentation, use this command:
105126
``` bash
106127
ansible-doc oracle.oci.[module_name]

THIRD_PARTY_LICENSES.txt

+204-102
Large diffs are not rendered by default.

UserGuide.md

+7
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ Helps in checking if the create operation will create the resource or not. It wi
3535
check_mode: yes
3636
```
3737

38+
### Identity Home Region Redirect
39+
By default, Identity requests are redirected to the user home region even if you specify a different region.
40+
If you need to use Identity service with a region other than your home region, you can override this behavior by setting this variable to any value:
41+
- Environment variable: OCI_IDENTITY_DO_NOT_REDIRECT_TO_HOME_REGION
42+
43+
44+
3845
### Avoiding reliance on server side default values
3946
Before our modules execute any operation, they check with the service to determine if that operation is necessary or if the state is already such that the operation would be a no-op. For create operations, this means checking if a resource already exists that matches the parameters a user supplied. The modules will attempt to find a matching resource *only* based on the parameters you supply. This means that if you omit an optional parameter and rely on the server side default value, future invocations of the same playbook can potentially match a resource that has a different value for that parameter.
4047

docs/conf.py

-6
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424

2525
__metaclass__ = type
2626

27-
from recommonmark.parser import CommonMarkParser
28-
2927
# sys.path.insert(0, os.path.abspath('.'))
3028

3129
import sphinx_rtd_theme
@@ -192,7 +190,3 @@
192190

193191
# The suffix of source filenames.
194192
source_suffix = [".rst", ".md"]
195-
196-
# source_parsers = {
197-
# ".md": CommonMarkParser,
198-
# }

galaxy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace: oracle
99
name: oci
1010

1111
# The version of the collection. Must be compatible with semantic versioning
12-
version: 2.6.0
12+
version: 2.7.0
1313

1414
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
1515
readme: README.md

plugins/module_utils/oci_common_utils.py

+1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
"data_safe_private_endpoint": "datasafeprivateendpoints",
109109
"bds_instance": "bds",
110110
"stack": "ormstack",
111+
"workspace": "disworkspace",
111112
}
112113

113114
CREATE_OPERATION_KEY = "CREATE"

plugins/module_utils/oci_custom_helpers_utils.py

+2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def get_custom_class_mapping(modules):
6666
oci_mysql_custom_helpers,
6767
oci_bigdata_custom_helpers,
6868
oci_usage_api_custom_helpers,
69+
oci_ocvp_custom_helpers,
6970
) # noqa
7071

7172
custom_helper_mapping = get_custom_class_mapping(
@@ -106,5 +107,6 @@ def get_custom_class_mapping(modules):
106107
oci_mysql_custom_helpers,
107108
oci_bigdata_custom_helpers,
108109
oci_usage_api_custom_helpers,
110+
oci_ocvp_custom_helpers,
109111
]
110112
)

plugins/module_utils/oci_database_custom_helpers.py

+92-3
Original file line numberDiff line numberDiff line change
@@ -392,12 +392,54 @@ class AutonomousContainerDatabaseHelperCustom:
392392
# the quarterly maintenance window. However object `UpdateAutonomousContainerDatabase` represents it with different
393393
# name 'maintenance_window_details'.
394394
def is_update_necessary(self, existing_resource_dict):
395+
resource_dict = dict(existing_resource_dict)
396+
resource_dict["maintenance_window_details"] = resource_dict.pop(
397+
"maintenance_window", None
398+
)
399+
return super(AutonomousContainerDatabaseHelperCustom, self).is_update_necessary(
400+
resource_dict
401+
)
402+
403+
def get_existing_resource_dict_for_idempotence_check(self, existing_resource):
404+
existing_resource_dict = super(
405+
AutonomousContainerDatabaseHelperCustom, self
406+
).get_existing_resource_dict_for_idempotence_check(existing_resource)
407+
395408
existing_resource_dict[
396409
"maintenance_window_details"
397410
] = existing_resource_dict.pop("maintenance_window", None)
398-
return super(AutonomousContainerDatabaseHelperCustom, self).is_update_necessary(
399-
existing_resource_dict
400-
)
411+
return existing_resource_dict
412+
413+
def list_resources(self):
414+
# Method `ListAutonomousContainerDatabases` has filer `infrastructureType` which returns resources that
415+
# match the given Infrastructure Type. If not passed API sets its value to `CLOUD`. In order to return ExaCC
416+
# resources it's necessary to pass `infrastructureType` = `CLOUD_AT_CUSTOMER` and `infrastructureType` = `CLOUD`
417+
# for non ExaCC resources.
418+
if not (
419+
self.module.params.get("autonomous_exadata_infrastructure_id")
420+
and self.module.params.get("autonomous_vm_cluster_id")
421+
):
422+
optional_kwargs = super(
423+
AutonomousContainerDatabaseHelperCustom, self
424+
).get_optional_kwargs_for_list()
425+
required_kwargs = super(
426+
AutonomousContainerDatabaseHelperCustom, self
427+
).get_required_kwargs_for_list()
428+
kwargs = oci_common_utils.merge_dicts(required_kwargs, optional_kwargs)
429+
430+
autonomous_container_database_at_cloud = oci_common_utils.list_all_resources(
431+
self.client.list_autonomous_container_databases, **kwargs
432+
)
433+
434+
kwargs["infrastructure_type"] = "CLOUD_AT_CUSTOMER"
435+
autonomous_container_database_cloud_at_customer = oci_common_utils.list_all_resources(
436+
self.client.list_autonomous_container_databases, **kwargs
437+
)
438+
return (
439+
autonomous_container_database_at_cloud
440+
+ autonomous_container_database_cloud_at_customer
441+
)
442+
return super(AutonomousContainerDatabaseHelperCustom, self).list_resources()
401443

402444

403445
class VmClusterNetworkHelperCustom:
@@ -544,3 +586,50 @@ def update_resource(self):
544586
operation_response=operation_response,
545587
wait_for_states=oci_common_utils.get_work_request_completed_states(),
546588
).wait()
589+
590+
591+
class BackupDestinationHelperCustom:
592+
def __init__(self, *args, **kwargs):
593+
super(BackupDestinationHelperCustom, self).__init__(*args, **kwargs)
594+
self.delete_vpc_users_from_update_model_dict = False
595+
596+
# resource returned from server doesn't have an attribute `mount_type_details` Thus we add this attribute in
597+
# existing resource dict by using values returned for parameters `nfs_mount_type` , `local_mount_point_path`,
598+
# `nfs_server` & `nfs_server_export`.
599+
def get_existing_resource_dict_for_idempotence_check(self, resource):
600+
resource_dict = super(
601+
BackupDestinationHelperCustom, self
602+
).get_existing_resource_dict_for_idempotence_check(resource)
603+
resource_dict["mount_type_details"] = {
604+
"mount_type": resource_dict.get("nfs_mount_type", None),
605+
"local_mount_point_path": resource_dict.get("local_mount_point_path", None),
606+
"nfs_server": resource_dict.get("nfs_server", None),
607+
"nfs_server_export": resource_dict.get("nfs_server_export", None),
608+
}
609+
return resource_dict
610+
611+
def get_update_model_dict_for_idempotence_check(self, update_model):
612+
update_model_dict = super(
613+
BackupDestinationHelperCustom, self
614+
).get_update_model_dict_for_idempotence_check(update_model)
615+
if "vpc_users" in update_model_dict:
616+
del update_model_dict["vpc_users"]
617+
return update_model_dict
618+
619+
def is_update_necessary(self, existing_resource_dict):
620+
vpc_users_source_list = self.module.params.get("vpc_users")
621+
vpc_users_target_list = existing_resource_dict["vpc_users"]
622+
623+
if vpc_users_source_list is not None and not all(
624+
[
625+
oci_common_utils.is_in_list(
626+
vpc_users_target_list, element, ignore_attr_if_not_in_target=False,
627+
)
628+
for element in vpc_users_source_list
629+
]
630+
):
631+
return True
632+
633+
return super(BackupDestinationHelperCustom, self).is_update_necessary(
634+
existing_resource_dict
635+
)

plugins/module_utils/oci_identity_custom_helpers.py

+54-4
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
from ansible_collections.oracle.oci.plugins.module_utils import oci_common_utils
1414

1515
try:
16-
from oci.exceptions import ServiceError
17-
18-
# from oci.exceptions import ServiceError, MaximumWaitTimeExceeded
16+
from oci.exceptions import ServiceError, MaximumWaitTimeExceeded
1917

2018
HAS_OCI_PY_SDK = True
2119
except ImportError:
@@ -341,6 +339,8 @@ def prepare_result(self, *args, **kwargs):
341339

342340

343341
# class TagActionsHelperCustom:
342+
# # overriding the perform_action method as bulk_delete tags operation does not support
343+
# # get_resource method which is an integral part of the main perform_action method
344344
# def perform_action(self, action):
345345
# action_fn = self.get_action_fn(action)
346346
# if not action_fn:
@@ -354,7 +354,7 @@ def prepare_result(self, *args, **kwargs):
354354
# # if sent list is empty or None, return back without performing the action with
355355
# # status of resource as not changed
356356
# tag_ids = self.module.params.get("tag_definition_ids")
357-
# if tag_ids is None or tag_ids == []:
357+
# if not tag_ids:
358358
# return self.prepare_result(
359359
# changed=False, resource_type=self.resource_type, resource=None
360360
# )
@@ -371,3 +371,53 @@ def prepare_result(self, *args, **kwargs):
371371
# return self.prepare_result(
372372
# changed=True, resource_type=self.resource_type, resource=None,
373373
# )
374+
375+
376+
class CompartmentActionsHelperCustom:
377+
# overriding the perform_action method as bulk_move and bulk_delete actions do not support
378+
# get_resource method which is an integral part of the main perform_action method
379+
def perform_action(self, action):
380+
if action in ["move", "recover"]:
381+
return super(CompartmentActionsHelperCustom, self).perform_action(action)
382+
383+
action_fn = self.get_action_fn(action)
384+
if not action_fn:
385+
self.module.fail_json(msg="{0} not supported by the module.".format(action))
386+
387+
if self.check_mode:
388+
return self.prepare_result(
389+
changed=True, resource_type=self.resource_type, resource=None
390+
)
391+
392+
# if resource list is empty or None, return back without performing the action with
393+
# status of resource as not changed
394+
resources_list = self.module.params.get("resources")
395+
if not resources_list:
396+
return self.prepare_result(
397+
changed=False, resource_type=self.resource_type, resource=None
398+
)
399+
400+
try:
401+
action_fn()
402+
except MaximumWaitTimeExceeded as mwtex:
403+
self.module.fail_json(msg=str(mwtex))
404+
except ServiceError as se:
405+
self.module.fail_json(
406+
msg="Performing action failed with exception: {0}".format(se.message)
407+
)
408+
else:
409+
return self.prepare_result(
410+
changed=True, resource_type=self.resource_type, resource=None,
411+
)
412+
413+
# this method is overridden to ensure idempotency for the move and recover actions
414+
def is_action_necessary(self, action, resource_data):
415+
if action == "move":
416+
return resource_data.compartment_id != self.module.params.get(
417+
"target_compartment_id"
418+
)
419+
if action == "recover":
420+
return resource_data.lifecycle_state == "DELETED"
421+
return super(CompartmentActionsHelperCustom, self).is_action_necessary(
422+
action, resource_data
423+
)

0 commit comments

Comments
 (0)