Hi

You can set and get custom values like

  - name: Set Custom Attributes
    community.vmware.vmware_guest_custom_attributes:
      validate_certs: False
      hostname: '{{ vcenter_hostname }}'
      username: '{{ vcenter_username }}'
      password: '{{ vcenter_password }}'
      state: present
      name: 'dev-1'
      attributes:
        - name: OS
          value: 'Windows Server 2019'

  - name: Get guest information
    community.vmware.vmware_guest_info:
      validate_certs: False
      hostname: '{{ vcenter_hostname }}'
      username: '{{ vcenter_username }}'
      password: '{{ vcenter_password }}'
      name: 'dev-1'
      datacenter: Asia-Datacenter1


The output will be like -

ok: [localhost] => {
    "changed": false,
    "instance": {
        "annotation": "",
        "current_snapshot": null,
        "customvalues": {
            "OS": "Windows Server 2019"
        },
...

On Sun, Feb 7, 2021 at 6:25 PM Dick Visser <[email protected]> wrote:

> That's not really an example of the actual data structure. So for the
> moment the answer is that what you want should be possible.
>
>
> On Sun, 7 Feb 2021 at 09:58, [email protected] <[email protected]> wrote:
>
>> Thanks for Reply, just to give you more context
>>
>> The custom attributes i have added are
>>
>>
>> OS
>> Application
>> Owner
>>
>> Etc...
>>
>> Now why OS ? That is as the OS seen by vCenter is say Ubuntu .,... but it
>> does not tell if that is Ubuntu18.04 or Ubuntu20.04 ... so i have added
>> them manually for now.. but looking for way to Automate that.
>>
>> Thanks
>>
>> On Saturday, February 6, 2021 at 10:46:52 PM UTC-8 [email protected]
>> wrote:
>>
>>> You could override the values by combining it with a specially crafter
>>> dictionary, or loop over it, etc.
>>> How exactly you do this depends on the data structure, but the module
>>> documentation does not mention any such custom attributes.
>>> If you have an example of your playbook and the resulting data
>>> structure?
>>>
>>> On Sun, 7 Feb 2021 at 06:03, [email protected] <[email protected]>
>>> wrote:
>>> >
>>> > Hi
>>> >
>>> > anyone can suggest Please if we can update the say a 'custom
>>> attribute' called OS from OS level with below
>>> >
>>> >
>>> https://docs.ansible.com/ansible/latest/collections/community/vmware/vmware_vm_info_module.html
>>> >
>>> > Say i want to use Windows 2019 DataCenter .. which is not aviable btw
>>> in vCenter 6.7 .. so getting that as ansible facts and add to attributes
>>> somehow
>>> >
>>> > Thanks
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> Groups "Ansible Project" group.
>>> > To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> > To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/161ffe5a-656f-4ea9-8d7d-e7518b7e3936n%40googlegroups.com.
>>>
>>>
>>>
>>>
>>> --
>>> Dick Visser
>>> Trust & Identity Service Operations Manager
>>> GÉANT
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/92953dbf-6496-4c28-8c55-9d5645dece82n%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/92953dbf-6496-4c28-8c55-9d5645dece82n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> Sent from a mobile device - please excuse the brevity, spelling and
> punctuation.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwO4FPudK-arMRZJxQvhdLGJZxF4JdQnCXMoNqt6O_-M%2Bw%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAL8fbwO4FPudK-arMRZJxQvhdLGJZxF4JdQnCXMoNqt6O_-M%2Bw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Thanks,
Abhijeet Kasurde

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAFwWkHoSgGt%2B3WUF5Bd40dA_qwUQ-m7HKzoGASyMJqGKCPmZ4g%40mail.gmail.com.

Reply via email to