Skip to content

Commit

Permalink
Merge branch 'dev' into Add_max_message_size_in_kilobytes
Browse files Browse the repository at this point in the history
  • Loading branch information
xuzhang3 authored Apr 6, 2023
2 parents 007d48e + c6021f9 commit 027e326
Show file tree
Hide file tree
Showing 65 changed files with 1,247 additions and 241 deletions.
55 changes: 55 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,60 @@
# Change Log

## v1.15.0 (2023-03-15)

### NEW MODULES
- azure_rm_multiplemanageddisks: New module to create/update/delete/attach multiple disks ([#936](https://github.com/ansible-collections/azure/pull/936))
- azure_rm_sqlelasticpool: Add azure_rm_sqlelasticpool.py to create Elastic Pool ([#1027](https://github.com/ansible-collections/azure/pull/1027))
- azure_rm_sqlelasticpool_info: Add azure_rm_sqlelasticpool_info.py to get Elastic Pool info ([#1027](https://github.com/ansible-collections/azure/pull/1027))
- azure_rm_sqlmanagedinstance: Add azure_rm_sqlmanagedinstance module ([#1039](https://github.com/ansible-collections/azure/pull/1039))
- azure_rm_sqlmanagedinstance_info: Add azure_rm_sqlmanagedinstance module ([#1039](https://github.com/ansible-collections/azure/pull/1039))

### FEATURE ENHANCEMENT
- requirements-azure.txt: Upgrade azure-mgmt-apimanagement to 3.0.0 ([#943](https://github.com/ansible-collections/azure/pull/943))
- azure_rm_openshiftmanagedcluster: Add new choices to vm_size in azure_rm_openshiftmanagedcluster.py ([#979](https://github.com/ansible-collections/azure/pull/979))
- azure_rm_appgateway: Add new parameters to azure_rm_appgateway ([#990](https://github.com/ansible-collections/azure/pull/990))
- azure_rm.py: Add compose support in inventory/azure_rm.py ([#1065](https://github.com/ansible-collections/azure/pull/1065))
- azure_rm_backupazurevm: add option for recovery point expiry time ([#1057](https://github.com/ansible-collections/azure/pull/1057))
- runtime.yml: Keep action_groups and modules list consistent #([1042](https://github.com/ansible-collections/azure/pull/1042))
- azure_rm_virtualnetworkpeering: Add synchronizing of VNet peering when sync level is LocalNotInSync ([#1025](https://github.com/ansible-collections/azure/pull/1025))
- azure_rm_deployment: Upgrade azure-mgmt-resource to 21.1.0 ([#960](https://github.com/ansible-collections/azure/pull/960))
- azure_rm_deployment_info: Upgrade azure-mgmt-resource to 21.1.0 ([#960](https://github.com/ansible-collections/azure/pull/960))
- azure_rm_lock: Upgrade azure-mgmt-resource to 21.1.0 ([#960](https://github.com/ansible-collections/azure/pull/960))
- azure_rm_subscription: Upgrade azure-mgmt-resource to 21.1.0 ([#960](https://github.com/ansible-collections/azure/pull/960))
- azure_rm_subscription_info: Upgrade azure-mgmt-resource to 21.1.0 ([#960](https://github.com/ansible-collections/azure/pull/960))
- azure_rm_resourcegroup: Upgrade azure-mgmt-resource to 21.1.0 ([#960](https://github.com/ansible-collections/azure/pull/960))
- azure_rm_resourcegroup_info: Upgrade azure-mgmt-resource to 21.1.0 ([#960](https://github.com/ansible-collections/azure/pull/960))
- azure_rm_virtualmachine: Upgrade azure-mgmt-resource to 21.1.0 ([#960](https://github.com/ansible-collections/azure/pull/960))
- azure_rm_storageblob: Make batch_upload honour `force` attribute in azure_rm_storageblob ([#1018](https://github.com/ansible-collections/azure/pull/1018))
- azure_rm_virtualnetwork: Add `flow_timeout_in_minutes` to azure_rm_virtualnetwork ([#1036](https://github.com/ansible-collections/azure/pull/1036))
- azure_rm_virtualnetwork_info: Add `flow_timeout_in_minutes` to azure_rm_virtualnetwork ([#1036](https://github.com/ansible-collections/azure/pull/1036))
- requirements-azure.txt: Bump cryptography from 38.0.1 to 38.0.3 ([#1035](https://github.com/ansible-collections/azure/pull/1035))
- azure_rm_galleryimageversion_info: Read paginated response for gallery image versions ([#1073](https://github.com/ansible-collections/azure/pull/1073))
- azure_rm_virtualmachine: Add `security_profile` options to azure_rm_virtualmachine ([#1033](https://github.com/ansible-collections/azure/pull/1033))
- azure_rm_virtualmachine_info: Add `security_profile` options to azure_rm_virtualmachine ([#1033](https://github.com/ansible-collections/azure/pull/1033))

### BUG FIXING
- azure_rm_deployment: Fix Ansible azure_rm_deployment module returns error but deployment in Azure was successful ([#986](https://github.com/ansible-collections/azure/pull/986))
- azure_rm.py: support for environment variable ANSIBLE_AZURE_VM_RESOURCE_GROUPS ([#975](https://github.com/ansible-collections/azure/pull/975))
- azure_rm_common.py: Ensure trailing slash on base_url ([#984](https://github.com/ansible-collections/azure/pull/984))
- azure_rm_virtualmachine: Correct spelling errors in documents ([#1012](https://github.com/ansible-collections/azure/pull/1012))
- azure_rm_storageblob: Format the md5 value returned by azure_rm_storageblob.py ([#1038](https://github.com/ansible-collections/azure/pull/1038))
- aure_rm_loadbalancer: The zone default value is None if not configured ([#1060](https://github.com/ansible-collections/azure/pull/1060))
- README.md: Correct spelling errors in documents ([#1059](https://github.com/ansible-collections/azure/pull/1059))
- azure_rm_securitygroup: Fixed idempotent error due to protocol ([#1064](https://github.com/ansible-collections/azure/pull/1064))
- azure_rm_roleassignment: Correct document case's config ([#1053](https://github.com/ansible-collections/azure/pull/1053))
- azure_rm_privatednsrecordset: Change the defined long type to int ([#1058](https://github.com/ansible-collections/azure/pull/1058))
- azure_rm_keyvault: Add the required restriction to the parameter ([#1054](https://github.com/ansible-collections/azure/pull/1054))
- azure_rm_dnsrecordset: Change the defined long type to int ([#1052](https://github.com/ansible-collections/azure/pull/1052))
- azure_rm_common.py: Add Ansible 2.14 and python 3.11 to CI ([#1074](https://github.com/ansible-collections/azure/pull/1074))
- azure_rm_backuppolicy: Add Ansible 2.14 and python 3.11 to CI ([#1074](https://github.com/ansible-collections/azure/pull/1074))
- azure_rm_manageddisk: Add Ansible 2.14 and python 3.11 to CI ([#1074](https://github.com/ansible-collections/azure/pull/1074))
- azure_rm_multiplemanageddisks: Add Ansible 2.14 and python 3.11 to CI ([#1074](https://github.com/ansible-collections/azure/pull/1074))
- azure_rm_sqlmanagedinstance: Add Ansible 2.14 and python 3.11 to CI ([#1074](https://github.com/ansible-collections/azure/pull/1074))
- azure_rm_servicebussaspolicy: Add Ansible 2.14 and python 3.11 to CI ([#1074](https://github.com/ansible-collections/azure/pull/1074))
- azure_rm_virtualmachine: Add Ansible 2.14 and python 3.11 to CI ([#1074](https://github.com/ansible-collections/azure/pull/1074))
- azure_rm_securitygroup: azure_rm_securitygroup is changed without actual changes when only capitalization differs ([#1096](https://github.com/ansible-collections/azure/pull/1096))

## v1.14.0 (2022-10-31)

### NEW MODULES
Expand Down
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace: azure
name: azcollection

# The version of the collection. Must be compatible with semantic versioning
version: 1.14.0
version: 1.15.0

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md
Expand Down
3 changes: 2 additions & 1 deletion plugins/doc_fragments/azure_rm.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class ModuleDocFragment(object):
choices: ['azure_rm', 'azure.azcollection.azure_rm']
include_vm_resource_groups:
description: A list of resource group names to search for virtual machines. '\*' will include all resource
groups in the subscription.
groups in the subscription. Can also be set comma separated resource group names via the
C(ANSIBLE_AZURE_VM_RESOURCE_GROUPS) environment variable.
default: ['*']
include_vmss_resource_groups:
description: A list of resource group names to search for virtual machine scale sets (VMSSs). '\*' will
Expand Down
2 changes: 2 additions & 0 deletions plugins/module_utils/azure_rm_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,7 @@ def management_groups_client(self):
self._management_group_client = self.get_mgmt_svc_client(ManagementGroupsClient,
base_url=self._cloud_environment.endpoints.resource_manager,
suppress_subscription_id=True,
is_track2=True,
api_version='2020-05-01')
return self._management_group_client

Expand Down Expand Up @@ -1267,6 +1268,7 @@ def marketplace_client(self):
self.log('Getting marketplace agreement client')
if not self._marketplace_client:
self._marketplace_client = self.get_mgmt_svc_client(MarketplaceOrderingAgreements,
is_track2=True,
base_url=self._cloud_environment.endpoints.resource_manager)
return self._marketplace_client

Expand Down
70 changes: 63 additions & 7 deletions plugins/modules/azure_rm_containerinstance.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
choices:
- public
- none
- private
default: 'none'
dns_name_label:
description:
Expand Down Expand Up @@ -165,6 +166,12 @@
- always
- on_failure
- never
subnet_ids:
description:
- The subnet resource IDs for a container group.
- Multiple subnets are not yet supported. Only 1 subnet can be used.
type: list
elements: str
volumes:
description:
- List of Volumes that can be mounted by containers in this container group.
Expand Down Expand Up @@ -299,6 +306,25 @@
- name: myvolume1
git_repo:
repository: "https://github.com/Azure-Samples/aci-helloworld.git"
- name: Create sample container instance with subnet
azure_rm_containerinstance:
resource_group: myResourceGroup
name: myContainerInstanceGroup
os_type: linux
ip_address: private
location: eastus
subnet_ids:
- "{{ subnet_id }}"
ports:
- 80
containers:
- name: mycontainer1
image: httpd
memory: 1.5
ports:
- 80
- 81
'''
RETURN = '''
id:
Expand Down Expand Up @@ -522,7 +548,7 @@ def __init__(self):
ip_address=dict(
type='str',
default='none',
choices=['public', 'none']
choices=['public', 'none', 'private']
),
dns_name_label=dict(
type='str',
Expand Down Expand Up @@ -562,7 +588,11 @@ def __init__(self):
type='list',
elements='dict',
options=volumes_spec
)
),
subnet_ids=dict(
type='list',
elements='str',
),
)

self.resource_group = None
Expand All @@ -573,14 +603,15 @@ def __init__(self):
self.dns_name_label = None
self.containers = None
self.restart_policy = None
self.subnet_ids = None

self.tags = None

self.results = dict(changed=False, state=dict())
self.cgmodels = None

required_if = [
('state', 'present', ['containers'])
('state', 'present', ['containers']), ('ip_address', 'private', ['subnet_ids'])
]

super(AzureRMContainerInstance, self).__init__(derived_arg_spec=self.module_arg_spec,
Expand Down Expand Up @@ -626,13 +657,16 @@ def exec_module(self, **kwargs):
elif self.state == 'present':
self.log("Need to check if container group has to be deleted or may be updated")
update_tags, newtags = self.update_tags(response.get('tags', dict()))
if update_tags:
self.tags = newtags

if self.force_update:
self.log('Deleting container instance before update')
if not self.check_mode:
self.delete_containerinstance()
elif update_tags:
if not self.check_mode:
self.tags = newtags
self.results['changed'] = True
response = self.update_containerinstance()

if self.state == 'present':

Expand All @@ -652,6 +686,23 @@ def exec_module(self, **kwargs):

return self.results

def update_containerinstance(self):
'''
Updates a container service with the specified configuration of orchestrator, masters, and agents.
:return: deserialized container instance state dictionary
'''
try:
response = self.containerinstance_client.container_groups.update(resource_group_name=self.resource_group,
container_group_name=self.name,
resource=dict(tags=self.tags))
if isinstance(response, LROPoller):
response = self.get_poller_result(response)
except Exception as exc:
self.fail("Error when Updating ACI {0}: {1}".format(self.name, exc.message or str(exc)))

return response.as_dict()

def create_update_containerinstance(self):
'''
Creates or updates a container service with the specified configuration of orchestrator, masters, and agents.
Expand Down Expand Up @@ -711,20 +762,25 @@ def create_update_containerinstance(self):
environment_variables=variables,
volume_mounts=volume_mounts))

if self.ip_address == 'public':
if self.ip_address is not None:
# get list of ports
if len(all_ports) > 0:
ports = []
for port in all_ports:
ports.append(self.cgmodels.Port(port=port, protocol="TCP"))
ip_address = self.cgmodels.IpAddress(ports=ports, dns_name_label=self.dns_name_label, type='public')
ip_address = self.cgmodels.IpAddress(ports=ports, dns_name_label=self.dns_name_label, type=self.ip_address)

subnet_ids = None
if self.subnet_ids is not None:
subnet_ids = [self.cgmodels.ContainerGroupSubnetId(id=item) for item in self.subnet_ids]

parameters = self.cgmodels.ContainerGroup(location=self.location,
containers=containers,
image_registry_credentials=registry_credentials,
restart_policy=_snake_to_camel(self.restart_policy, True) if self.restart_policy else None,
ip_address=ip_address,
os_type=self.os_type,
subnet_ids=subnet_ids,
volumes=self.volumes,
tags=self.tags)

Expand Down
7 changes: 7 additions & 0 deletions plugins/modules/azure_rm_containerinstance_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@
description:
- Environment variable value.
type: str
subnet_ids:
description:
- The subnet resource IDs for a container group.
type: list
returned: always
sample: [{'id': "/subscriptions/xxx-xxx/resourceGroups/myRG/providers/Microsoft.Network/virtualNetworks/vnetrpfx/subnets/subrpfx"}]
volumes:
description: The list of Volumes that can be mounted by container instances
returned: If container group has volumes
Expand Down Expand Up @@ -339,6 +345,7 @@ def format_item(self, item):
'containers': containers,
'restart_policy': _camel_to_snake(d.get('restart_policy')) if d.get('restart_policy') else None,
'tags': d.get('tags', None),
'subnet_ids': d.get('subnet_ids', None),
'volumes': d['volumes'] if 'volumes' in d else []
}
return d
Expand Down
21 changes: 11 additions & 10 deletions plugins/modules/azure_rm_devtestlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
from ansible.module_utils.common.dict_transformations import _snake_to_camel

try:
from msrestazure.azure_exceptions import CloudError
from msrest.polling import LROPoller
from azure.core.polling import LROPoller
from azure.core.exceptions import ResourceNotFoundError
from msrestazure.azure_operation import AzureOperationPoller
from azure.mgmt.devtestlabs import DevTestLabsClient
from msrest.serialization import Model
Expand Down Expand Up @@ -155,6 +155,7 @@ def exec_module(self, **kwargs):

self.mgmt_client = self.get_mgmt_svc_client(DevTestLabsClient,
base_url=self._cloud_environment.endpoints.resource_manager,
is_track2=True,
api_version='2018-10-15')

resource_group = self.get_resource_group(self.resource_group)
Expand Down Expand Up @@ -221,13 +222,13 @@ def create_update_devtestlab(self):
self.log("Creating / Updating the DevTest Lab instance {0}".format(self.name))

try:
response = self.mgmt_client.labs.create_or_update(resource_group_name=self.resource_group,
name=self.name,
lab=self.lab)
response = self.mgmt_client.labs.begin_create_or_update(resource_group_name=self.resource_group,
name=self.name,
lab=self.lab)
if isinstance(response, LROPoller) or isinstance(response, AzureOperationPoller):
response = self.get_poller_result(response)

except CloudError as exc:
except Exception as exc:
self.log('Error attempting to create the DevTest Lab instance.')
self.fail("Error creating the DevTest Lab instance: {0}".format(str(exc)))
return response.as_dict()
Expand All @@ -240,9 +241,9 @@ def delete_devtestlab(self):
'''
self.log("Deleting the DevTest Lab instance {0}".format(self.name))
try:
response = self.mgmt_client.labs.delete(resource_group_name=self.resource_group,
name=self.name)
except CloudError as e:
response = self.mgmt_client.labs.begin_delete(resource_group_name=self.resource_group,
name=self.name)
except Exception as e:
self.log('Error attempting to delete the DevTest Lab instance.')
self.fail("Error deleting the DevTest Lab instance: {0}".format(str(e)))

Expand All @@ -262,7 +263,7 @@ def get_devtestlab(self):
found = True
self.log("Response : {0}".format(response))
self.log("DevTest Lab instance : {0} found".format(response.name))
except CloudError as e:
except ResourceNotFoundError as e:
self.log('Did not find the DevTest Lab instance.')
if found is True:
return response.as_dict()
Expand Down
Loading

0 comments on commit 027e326

Please sign in to comment.