Skip to content

Commit

Permalink
Merged changes of Azure modules from Ansible repo (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
ansibleazurebot authored and yuwzho committed Apr 24, 2019
1 parent ebf3494 commit afbcc3a
Show file tree
Hide file tree
Showing 17 changed files with 123 additions and 379 deletions.
6 changes: 3 additions & 3 deletions files/sha.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lib/ansible/module_utils/azure_rm_common.py": "8b1b22ddc7dad0d901ecbd96a982e34429bdfdb9",
"lib/ansible/modules/cloud/azure": "22f666c9620396fb1ff7f4559b91182674e99008",
"lib/ansible/module_utils/azure_rm_common.py": "204db4d0444b2d1d3929774b5ac11b71893d3fb6",
"lib/ansible/modules/cloud/azure": "8de2acb81979cf09f661a74e1bc25bf4a3f453da",
"packaging/requirements/requirements-azure.txt": "8b1b22ddc7dad0d901ecbd96a982e34429bdfdb9",
"test/integration/targets": "dcbfa60413ece9d3e68fa44fa303a79003bbec75"
"test/integration/targets": "0d3d0025055e03f778ef8f13abc4e8adb2f774b8"
}
3 changes: 2 additions & 1 deletion library/_azure_rm_managed_disk_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ def managed_disk_to_dict(managed_disk):
disk_size_gb=managed_disk.disk_size_gb,
os_type=managed_disk.os_type.lower() if managed_disk.os_type else None,
storage_account_type=managed_disk.sku.name if managed_disk.sku else None,
managed_by=managed_disk.managed_by
managed_by=managed_disk.managed_by,
zone=managed_disk.zones[0] if managed_disk.zones and len(managed_disk.zones) > 0 else ''
)


Expand Down
6 changes: 6 additions & 0 deletions library/_azure_rm_virtualmachine_scaleset.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,9 +839,15 @@ def exec_module(self, **kwargs):
.ip_configurations[0].load_balancer_backend_address_pools = load_balancer_backend_address_pools
vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
.ip_configurations[0].load_balancer_inbound_nat_pools = load_balancer_inbound_nat_pools
vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
.ip_configurations[0].application_gateway_backend_address_pools = None
elif self.application_gateway:
vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
.ip_configurations[0].application_gateway_backend_address_pools = application_gateway_backend_address_pools
vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
.ip_configurations[0].load_balancer_backend_address_pools = None
vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
.ip_configurations[0].load_balancer_inbound_nat_pools = None

if self.data_disks is not None:
data_disks = []
Expand Down
4 changes: 3 additions & 1 deletion library/azure_rm_functionapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
- azure_tags
author:
- "Thomas Stringer (@tstringer)"
- "Thomas Stringer (@trstringer)"
'''

EXAMPLES = '''
Expand Down Expand Up @@ -365,6 +365,8 @@ def necessary_functionapp_settings(self):
function_app_settings.append(NameValuePair(name='WEBSITE_CONTENTSHARE', value=self.name))
else:
function_app_settings.append(NameValuePair(name='FUNCTIONS_EXTENSION_VERSION', value='~2'))
function_app_settings.append(NameValuePair(name='WEBSITES_ENABLE_APP_SERVICE_STORAGE', value=False))
function_app_settings.append(NameValuePair(name='AzureWebJobsStorage', value=self.storage_connection_string))

return function_app_settings

Expand Down
2 changes: 1 addition & 1 deletion library/azure_rm_functionapp_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
- azure
author:
- "Thomas Stringer (@tstringer)"
- "Thomas Stringer (@trstringer)"
'''

EXAMPLES = '''
Expand Down
2 changes: 1 addition & 1 deletion library/azure_rm_loadbalancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@
- azure_tags
author:
- "Thomas Stringer (@tstringer)"
- "Thomas Stringer (@trstringer)"
- "Yuwei Zhou (@yuwzho)"
'''

Expand Down
2 changes: 1 addition & 1 deletion library/azure_rm_loadbalancer_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
- azure
author:
- "Thomas Stringer (@tstringer)"
- "Thomas Stringer (@trstringer)"
'''

EXAMPLES = '''
Expand Down
3 changes: 2 additions & 1 deletion library/azure_rm_manageddisk_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ def managed_disk_to_dict(managed_disk):
disk_size_gb=managed_disk.disk_size_gb,
os_type=managed_disk.os_type.lower() if managed_disk.os_type else None,
storage_account_type=managed_disk.sku.name if managed_disk.sku else None,
managed_by=managed_disk.managed_by
managed_by=managed_disk.managed_by,
zone=managed_disk.zones[0] if managed_disk.zones and len(managed_disk.zones) > 0 else ''
)


Expand Down
5 changes: 4 additions & 1 deletion library/azure_rm_resourcegroup_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ def __init__(self):

self.results = dict(
changed=False,
ansible_facts=dict(azure_resourcegroups=[])
ansible_facts=dict(azure_resourcegroups=[]),
resourcegroups=[]
)

self.name = None
Expand All @@ -170,6 +171,8 @@ def exec_module(self, **kwargs):
for item in self.results['ansible_facts']['azure_resourcegroups']:
item['resources'] = self.list_by_rg(item['name'])

self.results['resourcegroups'] = self.results['ansible_facts']['azure_resourcegroups']

return self.results

def get_item(self):
Expand Down
6 changes: 6 additions & 0 deletions library/azure_rm_virtualmachinescaleset.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,9 +839,15 @@ def exec_module(self, **kwargs):
.ip_configurations[0].load_balancer_backend_address_pools = load_balancer_backend_address_pools
vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
.ip_configurations[0].load_balancer_inbound_nat_pools = load_balancer_inbound_nat_pools
vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
.ip_configurations[0].application_gateway_backend_address_pools = None
elif self.application_gateway:
vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
.ip_configurations[0].application_gateway_backend_address_pools = application_gateway_backend_address_pools
vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
.ip_configurations[0].load_balancer_backend_address_pools = None
vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
.ip_configurations[0].load_balancer_inbound_nat_pools = None

if self.data_disks is not None:
data_disks = []
Expand Down
9 changes: 5 additions & 4 deletions module_utils/azure_rm_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
choices=['auto', 'cli', 'env', 'credential_file', 'msi']
),
profile=dict(type='str'),
subscription_id=dict(type='str', no_log=True),
subscription_id=dict(type='str'),
client_id=dict(type='str', no_log=True),
secret=dict(type='str', no_log=True),
tenant=dict(type='str', no_log=True),
Expand Down Expand Up @@ -1149,8 +1149,9 @@ def _get_profile(self, profile="default"):

return None

def _get_msi_credentials(self, subscription_id_param=None):
credentials = MSIAuthentication()
def _get_msi_credentials(self, subscription_id_param=None, **kwargs):
client_id = kwargs.get('client_id', None)
credentials = MSIAuthentication(client_id=client_id)
subscription_id = subscription_id_param or os.environ.get(AZURE_CREDENTIAL_ENV_MAPPING['subscription_id'], None)
if not subscription_id:
try:
Expand Down Expand Up @@ -1206,7 +1207,7 @@ def _get_credentials(self, params):

if auth_source == 'msi':
self.log('Retrieving credenitals from MSI')
return self._get_msi_credentials(arg_credentials['subscription_id'])
return self._get_msi_credentials(arg_credentials['subscription_id'], client_id=params.get('client_id', None))

if auth_source == 'cli':
if not HAS_AZURE_CLI_CORE:
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/targets/azure_rm_keyvault/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
# azure_rm_keyvaultkey tests
#

- name: create a kevyault key
- name: create a keyvault key
block:
- azure_rm_keyvaultkey:
keyvault_uri: https://vault{{ rpfx }}.vault.azure.net
Expand All @@ -172,7 +172,7 @@
state: absent
key_name: testkey

- name: delete a kevyault key
- name: delete a keyvault key
azure_rm_keyvaultkey:
keyvault_uri: https://vault{{ rpfx }}.vault.azure.net
state: absent
Expand All @@ -185,7 +185,7 @@
#
# azure_rm_keyvaultsecret tests
#
- name: create a kevyault secret
- name: create a keyvault secret
block:
- azure_rm_keyvaultsecret:
keyvault_uri: https://vault{{ rpfx }}.vault.azure.net
Expand All @@ -203,7 +203,7 @@
state: absent
secret_name: testsecret

- name: delete a kevyault secret
- name: delete a keyvault secret
azure_rm_keyvaultsecret:
keyvault_uri: https://vault{{ rpfx }}.vault.azure.net
state: absent
Expand Down
1 change: 0 additions & 1 deletion tests/integration/targets/azure_rm_manageddisk/aliases
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cloud/azure
shippable/azure/group3
destructive
disabled
azure_rm_manageddisk_facts
Loading

0 comments on commit afbcc3a

Please sign in to comment.