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

For Vmware_rest api ansible module the dry run mode --check option is not working #419

Open
deepakbk76 opened this issue Jun 6, 2023 · 0 comments

Comments

@deepakbk76
Copy link

deepakbk76 commented Jun 6, 2023

SUMMARY
ISSUE TYPE
  • Bug Report
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 Delete VM

@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.


##### ACTUAL RESULTS
<!--- Describe what actually happened. If possible run with extra verbosity (-vvvv) -->

<!--- Paste verbatim command output between quotes -->
```paste below

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant