Hi  Andrew, 

Please find the details . 
COMPONENT NAME

vmware.vmware_rest.vcenter_vm:
ANSIBLE VERSION
config file = None configured module search path = 
['/home/deep/.ansible/plugins/modules', 
'/usr/share/ansible/plugins/modules'] ansible python module location = 
/home/deep/.local/lib/python3.10/site-packages/ansible ansible collection 
location = /home/deep/.ansible/collections:/usr/share/ansible/collections 
executable location = /home/deep/.local/bin/ansible python version = 3.10.6 
(main, May 29 2023, 11:10:38) [GCC 11.3.0] jinja version = 3.1.2 libyaml = 
True 
COLLECTION VERSION

`# /home/deep/.ansible/collections/ansible_collections
Collection Version

vmware.vmware_rest 2.3.1
##### CONFIGURATION <!--- Paste verbatim output from "ansible-config dump 
--only-changed" between quotes --> ```paste below 
OS / ENVIRONMENT

PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/";
SUPPORT_URL="https://help.ubuntu.com/";
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/";
PRIVACY_POLICY_URL="
https://www.ubuntu.com/legal/terms-and-policies/privacy-policy";
UBUNTU_CODENAME=jammy
STEPS TO REPRODUCE

Try to dry run the playbook delvm.yml
ansible-playbook delvm.yml --check -i inventory --limit test-host

--

   - 
   
   name: Delete VM
   hosts: all
   gather_facts: false
   become: false
   
   tasks:
   
Lookup VM ID from the vm name

- name: "Lookup VM: {{ vm_name }}" vmware.vmware_rest.vcenter_vm_info: 
vcenter_hostname: "{{ vcenter.hostname }}" vcenter_username: "{{ 
vcenter.username }}" vcenter_password: "{{ vcenter.password }}" 
vcenter_validate_certs: "{{ vcenter.validate_certs }}" filter_names: "{{ 
vm_name }}" register: lookup_result delegate_to: "{{ delegation_host }}" 
Collect VM ID from the vm name
- name: "Collect information about VM: {{ vm_name }}" 
vmware.vmware_rest.vcenter_vm_info: vcenter_hostname: "{{ vcenter.hostname 
}}" vcenter_username: "{{ vcenter.username }}" vcenter_password: "{{ 
vcenter.password }}" vcenter_validate_certs: "{{ vcenter.validate_certs }}" 
vm: "{{ lookup_result.value[0].vm }}" register: vm_info delegate_to: "{{ 
delegation_host }}" 
@title <https://github.com/title> Delete VM@comment 
<https://github.com/comment> This task deletes the VM from the vcenter

- name: "Delete VM: {{ vm_name }}" vmware.vmware_rest.vcenter_vm: 
vcenter_hostname: "{{ vcenter.hostname }}" vcenter_username: "{{ 
vcenter.username }}" vcenter_password: "{{ vcenter.password }}" 
vcenter_validate_certs: "{{ vcenter.validate_certs }}" state: absent vm: 
"{{ vm_info.id }}" delegate_to: "{{ delegation_host }}" 
<!--- HINT: You can paste gist.github.com links for larger files --> ##### 
EXPECTED RESULTS excepted result its should not remove the vm and just dry 
run the steps but unfortunately with option --check it is removing the vm 
in vcenter not performing dry run. 

On Tuesday, June 6, 2023 at 6:36:46 PM UTC+5:30 Andrew Latham wrote:

> Deepak
>
> You may get more responses if you provide actual examples in the form of 
> playbook/task/role you are attempting. Please also identify the Ansible 
> version and the VMWare module/version you are using.
>
> On Tue, Jun 6, 2023 at 2:42 AM Deepak B K <[email protected]> wrote:
>
>> We are testing  ansible vmware module were we wanted to test in dry run 
>> mode the playbooks which has vmware rest modules used and we see the 
>> --check  or check_mode = yes is not working  its deletes the vm  where its 
>> except to just dry run the task . Just wanted to understand the dryrun 
>> works for vmware modules?
>>
>> Thanks 
>> Deepak Kumar
>>
>> -- 
>> 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/4a885873-a30e-48c9-bb69-8f93975e924bn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/4a885873-a30e-48c9-bb69-8f93975e924bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> -- 
> - Andrew "lathama" Latham -
>

-- 
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/ddb61e8e-f7c8-4d84-a70f-30313df0b9d1n%40googlegroups.com.

Reply via email to