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

Add "osName" from MS API "instanceView" to "azure_rm.py" Inventory Plugin #1776

Open
obartonek opened this issue Dec 4, 2024 · 2 comments
Open
Labels
hold The problem holds for a particular reason medium_priority Medium priority question Further information is requested work in In trying to solve, or in working with contributors

Comments

@obartonek
Copy link

SUMMARY

The current azure_rm.py plugin for Ansible inventory source supports only the osType attribute (e.g., Linux, Windows).

I would like to ask for adding the osName attribute from MS API instanceView, which provides more granular OS details (e.g., RedHat, Ubuntu, Oracle, etc.). This enhancement would enable better filtering and grouping of machines in Ansible inventories based on their specific operating system.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

azure_rm.py

ADDITIONAL INFORMATION

Adding osName would allow users to define conditional groups based on the specific operating system, providing more flexibility and precision when managing diverse environments.

plugin: azure.azcollection.azure_rm

conditional_groups:
  windows22_group: os_name == 'Windows Server 2022'
  windows19_group: os_name == 'Windows Server 2019'
  windows16_group: os_name == 'Windows Server 2016'
  redhat_group: os_name == 'RedHat' 
  oracle_group: os_name == 'Oracle'
  ubuntu_group: os_name == 'Ubuntu'
@Fred-sun
Copy link
Collaborator

Fred-sun commented Dec 9, 2024

@obartonek Now there is system-related information in the returned information, you can filter through the system information, the returned result is as follows, thank you!

                "image": {
                    "offer": "0001-com-ubuntu-server-focal",
                    "publisher": "Canonical",
                    "sku": "20_04-lts",
                    "version": "20.04.202410160"
                },
                "os_profile": {
                    "system": "linux"
                }
                "os_disk": {
                    "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/ansibletest2-a43da2d9-d8bd-44c8-9106-70586b824bea/providers/Microsoft.Compute/disks/shareddisk-vm-2",
                    "name": "shareddisk-vm-2",
                    "operating_system_type": "linux"
                },

@Fred-sun
Copy link
Collaborator

Fred-sun commented Dec 9, 2024

@obartonek Another way, you can add custom tags when creating VMS, so that VMS can be filtered by custom tags. Thank you!

@Fred-sun Fred-sun added question Further information is requested medium_priority Medium priority work in In trying to solve, or in working with contributors labels Dec 9, 2024
@Fred-sun Fred-sun added the hold The problem holds for a particular reason label Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hold The problem holds for a particular reason medium_priority Medium priority question Further information is requested work in In trying to solve, or in working with contributors
Projects
None yet
Development

No branches or pull requests

2 participants