With the introduction of the declarative tasks update (Version 7.0.0), module parameters have been revised to allow identification of objects using a single parameter that can accept either the name or the ID of the object. This replaces the need for multiple parameters previously used for object identification.
Example: Instead of using separate id and name parameters to identify a datacenter, a new parameter (datacenter) is now used, which accepts either the ID or the name of the datacenter.
This change applies to various other parameters used for identification, not limited to the resource created by the module.
Example: For nic identification, apart from the nic parameter, other resources like datacenter, server, and lan will be utilized.
NOTE: For this mechanism to function properly, ansible now assumes unique names for objects. If multiple objects with the same names are found, the operation will fail.
State Behavior for Modules
The update introduces changes in how states will work for the modules:
present:Looks for the object:-If it does not exist, create it.-If it already exists, it will function in the same way as the update state.update:-Updates the object if no unchangeable properties are modified.-Replaces the object if unchangeable properties are modified, creating a new object and removing the old one.-If `allow_replace` is set to false, the module will fail instead of replacing the object to avoid resource loss.absent:-Looks for the object:-If it does not exist, the operation is successful.-If it exists, delete it.
The allow_replace parameter
Defaults to false
If set to true, the replace behavior is allowed.
If set to false, when a resource would be replaced, an error will be thrown instead.
List of Parameters Triggering Resource Replacement
The following parameters, when changed or set, trigger resource replacement:
NOTE: The following parameters used to have default values which have been removed to avoid triggering a replacement without a value being set by the user (the former default value is in parentheses) :
cube_server:
availability_zone ('AUTO')
datacenter:
location ('us/las')
ipblock:
size (1)
volume:
size (10)
ssh_keys ([])
disk_type ('HDD')
licence_type ('UNKNOWN')
List of Parameter Changes
The update involves changes in parameter names, removal of parameters, and addition of new parameters for various modules. Here is the detailed list: