Hi Piotr,
You can directly use names to rename the object like in your case datastore
- community.vmware.vmware_object_rename:
new_name: "DS_117_1"
object_name: "ds_171_2"
object_type: Datastore
You can gather information about Managed object id for the datastore using
vmware_datastore_info as below
- name: Provide information about datastore {{ datastore_name }}
community.vmware.vmware_datastore_info:
datacenter: Asia-Datacenter1
name: "{{ datastore_name }}"
properties:
- _moId
schema: vsphere
delegate_to: localhost
register: datastore_info
- set_fact:
datastore_moid: "{{ datastore_info.datastores[0]['moid'] }}"
when: datastore_info.datastores[0]['moid'] is defined
On Mon, Mar 1, 2021 at 6:14 PM Jon POK <[email protected]> wrote:
> Maybe stupid qiestion object_moid where I can find it? it seems that
> rename object without this var wont work
> greetings Piotr
>
> poniedziałek, 1 marca 2021 o 13:09:34 UTC+1 Jon POK napisał(a):
>
>> Hello
>>
>> Thanks for hint but is not working only in vcenter ? I would like to
>> rename datastore on esxi host level
>> Anyway I will check it thx
>>
>> pon., 1 mar 2021 o 12:46 Dick Visser <[email protected]> napisał(a):
>>
>>> "datacener_name" looks like a typo
>>>
>>> But, as Abhijeet Kasurde already explained:
>>>
>>> > If you want to rename an object in VMware please use
>>> `vmware_object_rename` module.
>>>
>>>
>>> https://docs.ansible.com/ansible/latest/collections/community/vmware/vmware_object_rename_module.html
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Mon, 1 Mar 2021 at 10:37, Jon POK <[email protected]> wrote:
>>> >
>>> > the problem is that rename var is not recognized via module. Is it
>>> possible that module is not valid or has changed name
>>> >
>>> > fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unsupported
>>> parameters for (vmware_host_datastore) module: datacener_name, rename
>>> Supported parameters include: datastore_name, datastore_type,
>>> esxi_hostname, hostname, nfs_path, nfs_ro, nfs_server, password, port,
>>> proxy_host, proxy_port, state, username, validate_certs, vmfs_device_name,
>>> vmfs_version"}
>>> >
>>> > pon., 1 mar 2021 o 08:44 Jon POK <[email protected]> napisał(a):
>>> >>
>>> >> Hello
>>> >>
>>> >> After execution datastore is not changed.
>>> >> Today i will paste error from -vvv execution
>>> >>
>>> >> wt., 23 lut 2021, 09:43 użytkownik Dick Visser <[email protected]>
>>> napisał:
>>> >>>
>>> >>> What exactly does "its not working" mean?
>>> >>> Errors, etc?
>>> >>>
>>> >>> On Tue, 23 Feb 2021 at 08:00, Jon POK <[email protected]> wrote:
>>> >>>>
>>> >>>> Hello
>>> >>>>
>>> >>>> I am trying to execute this task
>>> >>>>
>>> >>>> - name: Rename Datastores on ESXi host vmware_host_datastore:
>>> >>>> hostname: '{{ vcenter_hostname }}'
>>> >>>> username: '{{ vcenter_username }}'
>>> >>>> password: '{{ vcenter_password }}'
>>> >>>> datacenter_name: '{{ datacenter }}'
>>> >>>> datastore_name: datastore(1)
>>> >>>> rename: new_datastore_1
>>> >>>> esxi_hostname: '{{ inventory_hostname }}' state: present
>>> >>>>
>>> >>>> but is not working
>>> >>>> Has anybody try this and knows how to fix it?
>>> >>>>
>>> >>>> Piotr
>>> >>>>
>>> >>>> --
>>> >>>> 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/fe60adee-e575-44bc-8323-665d49949d50n%40googlegroups.com
>>> .
>>> >>>
>>> >>> --
>>> >>> 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/CAL8fbwMAqqkW3M6-hmziXkrgTa2Y1%2BvEYpLz3KAdB6zxUb-Vmw%40mail.gmail.com
>>> .
>>> >
>>> > --
>>> > 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/CAMRMTZVz3Ho2agxhf033D9ZMjbsC9MTaQuA1MgijCH1s6uh5MA%40mail.gmail.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/CAL8fbwNw1gQY5wqCYAduy27ALBe%2ByV5X2_N86cHhcRf0wAsf3Q%40mail.gmail.com
>>> .
>>>
>> --
> 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/5266cffc-acab-439b-a2d1-e9454933dc72n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/5266cffc-acab-439b-a2d1-e9454933dc72n%40googlegroups.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/CAFwWkHoA1dk%3DC4qLg3rKr4gv-Zc3mTnhTjtDKy6WVKVpTWAG0Q%40mail.gmail.com.