Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return value not available anymore in azure_rm_networkinterface_info #1461

Closed
murdibb opened this issue Feb 22, 2024 · 3 comments · Fixed by #1462
Closed

Return value not available anymore in azure_rm_networkinterface_info #1461

murdibb opened this issue Feb 22, 2024 · 3 comments · Fixed by #1462
Labels
medium_priority Medium priority not a bug Not a bug work in In trying to solve, or in working with contributors

Comments

@murdibb
Copy link

murdibb commented Feb 22, 2024

Hi all,

I wanted to use subnet id from return value 'azure_networkinterfaces ' but it is not available anymore.
For me it seems it was part of predecessor 'azure_rm_networkinterface_facts', and is only added when called from that old module

if is_old_facts:
self.results['ansible_facts'] = {
'azure_networkinterfaces': self.serialize_nics(results)
}
self.results['networkinterfaces'] = self.to_dict_list(results)
return self.results

Please check and add it back or remove from documentation.
https://github.com/ansible-collections/azure/blob/9cfb3777de2599066fbacda4881e28d2b2f6248e/plugins/modules/azure_rm_networkinterface_info.py#L66C1-L66C24

Btw. any recommendation how to get subnet id from this module only? I get it that it can be combined with 'azure_rm_subnet_info'

Thanks!

@Fred-sun
Copy link
Collaborator

@murdibb You can obtain the subnet ID in the following two ways, hank you!

Print the subnet ID in the return value from azure_rm_subnet_info.py 
- name: Get subnet facts
  azure_rm_subnet_info:
    name: foobar
    virtual_network_name: My_Virtual_Network
    resource_group: "{{ resource_group }}"
  register: output
- name: Print the subnet ID in the return value from azure_rm_subnet_info.py
  debug:
    var: output.subnets[0].id

Print the subnet ID in the return value from azure_rm_subnet_info.py 
- name: Get virtual network fact
  azure_rm_virtualnetwork_info:
    name: My_Virtual_Network
    resource_group: "{{ resource_group }}"
  register: output

- name: Print the subnet ID in the return value from azure_rm_virtualnetwork_info.py
  debug:
    var: output.virtualnetworks[0].subnets

@Fred-sun Fred-sun added medium_priority Medium priority not a bug Not a bug work in In trying to solve, or in working with contributors labels Feb 23, 2024
@murdibb
Copy link
Author

murdibb commented Feb 23, 2024

@Fred-sun thanks for your answer!
To be precise, I want to get the subned id of a NIC so only your first suggestion applies. Yes I knew I can use that module to get subnet information.

Anyways the original issue is that the documentation and actual behaviour are not aligned for azure_rm_networkinterface_info. It would be cool to only use that single module to get subnetinfo, as subnet ID is usually needed on firewalls (keyvault, storage etc)

@Fred-sun
Copy link
Collaborator

@murdibb Yes, azure_rm_networkinterface_info does not return the subnet ID. However, we can obtain the subnet ID from the virtual network information returned by this module. We will add subnet information to the returned network card information later. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium_priority Medium priority not a bug Not a bug work in In trying to solve, or in working with contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants