ansible-collections/vmware.vmware_rest

vmware.vmware_rest does not honnor the ansible-playbook --check flag.

DonW16 opened this issue · 1 comments

DonW16 commented

#419
#363

Release branch is affect, not tested devel.

SUMMARY

The --check argument is not being honored when the vmware.vmware_rest Ansible module is being called and is still executing the code as you can see in the video below the POST request still gets sent when the check_mode: true parameter is set whereas the other honor the check flag and do not execute a request.

In the video was running a HTTP server and HTTPS server in python as you can see a post request is sent by the vmware.vmware_rest module to the HTTPS server but there is no request for HTTP because it honors the check_mode: true.

2023-12-21.16-47-10.mp4
ISSUE TYPE
  • Bug Report
COMPONENT NAME

vmware.vmware_rest

ANSIBLE VERSION
ansible-playbook 2.10.8
  config file = None
  configured module search path = ['/home/legion/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]

ansible 2.10.8
  config file = None
  configured module search path = ['/home/legion/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
COLLECTION VERSION
amazon.aws                1.4.0  
ansible.netcommon         1.5.0  
ansible.posix             1.1.1  
ansible.windows           1.4.0  
arista.eos                1.3.0  
awx.awx                   14.1.0 
azure.azcollection        1.4.0  
check_point.mgmt          1.0.6  
chocolatey.chocolatey     1.0.2  
cisco.aci                 1.1.1  
cisco.asa                 1.0.4  
cisco.intersight          1.0.10 
cisco.ios                 1.3.0  
cisco.iosxr               1.2.1  
cisco.meraki              2.2.0  
cisco.mso                 1.1.0  
cisco.nso                 1.0.3  
cisco.nxos                1.4.0  
cisco.ucs                 1.6.0  
cloudscale_ch.cloud       1.3.1  
community.aws             1.3.0  
community.azure           1.0.0  
community.crypto          1.4.0  
community.digitalocean    1.0.0  
community.docker          1.2.2  
community.fortios         1.0.0  
community.general         1.3.6  
community.google          1.0.0  
community.grafana         1.1.0  
community.hashi_vault     1.1.0  
community.hrobot          1.1.0  
community.kubernetes      1.1.1  
community.kubevirt        1.0.0  
community.libvirt         1.0.0  
community.mongodb         1.2.0  
community.mysql           1.2.0  
community.network         1.3.2  
community.okd             1.0.0  
community.postgresql      1.1.1  
community.proxysql        1.0.0  
community.rabbitmq        1.0.1  
community.routeros        1.1.0  
community.skydive         1.0.0  
community.vmware          1.7.0  
community.windows         1.3.0  
community.zabbix          1.2.0  
containers.podman         1.4.1  
cyberark.conjur           1.1.0  
cyberark.pas              1.0.5  
dellemc.os10              1.0.2  
dellemc.os6               1.0.6  
dellemc.os9               1.0.3  
f5networks.f5_modules     1.7.1  
fortinet.fortimanager     1.0.5  
fortinet.fortios          1.1.8  
frr.frr                   1.0.3  
gluster.gluster           1.0.1  
google.cloud              1.0.2  
hetzner.hcloud            1.2.1  
ibm.qradar                1.0.3  
infinidat.infinibox       1.2.4  
junipernetworks.junos     1.3.0  
mellanox.onyx             1.0.0  
netapp.aws                20.9.0 
netapp.elementsw          20.11.0
netapp.ontap              20.12.0
netapp_eseries.santricity 1.1.0  
netbox.netbox             1.2.1  
ngine_io.cloudstack       1.2.0  
ngine_io.exoscale         1.0.0  
ngine_io.vultr            1.1.0  
openstack.cloud           1.2.1  
openvswitch.openvswitch   1.1.0  
ovirt.ovirt               1.3.0  
purestorage.flasharray    1.6.2  
purestorage.flashblade    1.4.0  
servicenow.servicenow     1.0.4  
splunk.es                 1.0.2  
theforeman.foreman        1.5.1  
vyos.vyos                 1.1.1  
wti.remote                1.0.1
CONFIGURATION
NA
OS / ENVIRONMENT

No LSB modules are available.
Distributor ID: Linuxmint
Description: Linux Mint 21.2
Release: 21.2
Codename: victoria

STEPS TO REPRODUCE
---
- name: VMware REST API Playbook
  hosts: localhost
  gather_facts: false
  tasks:
    - name: This task will never make changes to the system
      ansible.builtin.lineinfile:
        line: "important config"
        dest: ~/vmware_ansible/myconfig.conf
        state: present
      check_mode: true # Does not execute.
      register: changes_to_important_config

    - name: POST request to server
      uri:
        url: "http://localhost:12345/"
        method: POST
        body: '{"key1": "value1", "key2": "value2"}'
        body_format: json
        headers:
          Content-Type: "application/json"
        status_code: 200
      check_mode: true # Does not execute.
      register: response

    - name: Get VM information
      vmware.vmware_rest.vcenter_vm_info:
        vcenter_hostname: "localhost"
        vcenter_username: "username"
        vcenter_password: "password"
        vcenter_validate_certs: false
        vm: "vm"
      check_mode: true # Executes?
      register: vm_info
EXPECTED RESULTS

vmware.vmware_rest does not execute at all when yaml check_mode: true .

ACTUAL RESULTS

Watch video :)

Duplicate of #419