vmware_guest does not add cd-rom for a VM

159 views
Skip to first unread message

Anil Kumar

unread,
May 12, 2022, 11:19:55 AM5/12/22
to Ansible Project
here is my code

- hosts: localhost
  connection: localhost
  vars:
   vcenter_hostname: myVcenter
   vcenter_username: **************
   vcenter_password: '**********'
  tasks:
  - name: Create a virtual machine from a template
    vmware_guest:
      hostname: "{{ vcenter_hostname }}"
      username: "{{ vcenter_username }}"
      password: "{{ vcenter_password }}"
      validate_certs: no
      folder: /RHEL
      name: mtest
      state: poweredon
      #template: template_el7
      cdrom:
       - controller_number: 0
         controller_type: sata
         unit_number: 0
         type: client
         state: present
    delegate_to: localhost

===========
$ ansible --version
ansible 2.9.1
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/athangal/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Aug 13 2020, 02:51:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

Anil Kumar

unread,
May 12, 2022, 1:13:35 PM5/12/22
to Ansible Project
Is this bug?

Dick Visser

unread,
May 12, 2022, 4:28:28 PM5/12/22
to ansible...@googlegroups.com


On 2022-05-12 (Thu) 19:13, Anil Kumar wrote:
> Is this bug?

Yes, but probably one in your own configuration:

> On Thursday, May 12, 2022 at 5:19:55 PM UTC+2 Anil Kumar wrote:
>
> here is my code
>
> - hosts: localhost
>   connection: localhost
>   vars:
>    vcenter_hostname: myVcenter
>    vcenter_username: **************
>    vcenter_password: '**********'
>   tasks:
>   - name: Create a virtual machine from a template
>     vmware_guest:
>       hostname: "{{ vcenter_hostname }}"
>       username: "{{ vcenter_username }}"
>       password: "{{ vcenter_password }}"
>       validate_certs: no
>       folder: /RHEL
>       name: mtest
>       state: poweredon
>       #template: template_el7
>       cdrom:
>        - controller_number: 0
>          controller_type: sata

You define type as sata, but the ansible version that you run only
supports 'ide':

https://docs.ansible.com/ansible/2.9/modules/vmware_guest_module.html#parameter-cdrom


Try upgrading to something less ancient, or use 'ide', or don't define
controller_type as 'ide' is the default for that anyway.


Dick
OpenPGP_0x266713D4E6EF488D.asc
OpenPGP_signature

Anil Kumar

unread,
May 13, 2022, 5:44:55 PM5/13/22
to Ansible Project
Thanks Much, correct, pin pointed the issue. (y)
Reply all
Reply to author
Forward
0 new messages