vmware-archive / ansible-module-vcloud-director

ansible-module-vcloud-director
Other
111 stars 85 forks source link

Customization script is not working #153

Open 387119 opened 3 years ago

387119 commented 3 years ago

expected behavior

when we try to add custom script manually then it looks like image ]

mean, script name vcloud put in "script file" field, and file content will be in "script" field, it looks correct and working.

actual behavior

when I try to do it using ansible, it`s working not as expected

 24   - name: Create vm
 25     vcd_vapp_vm:
 26       target_vm_name: "{{ item }}"
 27       target_vapp: "{{ target_vapp }}"
 28       source_vdc: "{{ source_vdc }}"
 29       target_vdc: "{{ target_vdc }}"
 30       source_catalog_name: "{{ source_catalog_name }}"
 31       source_template_name: "{{ source_template_name }}"
 32       source_vm_name: "{{ source_template_vm }}"
 33       hostname: "{{ item }}"
 34       #vmpassword: "{{ root_password }}"
 35       #vmpassword_auto: "false"
 36       #vmpassword_reset: "true"
 37       ip_allocation_mode: "{{ ip_allocation_mode }}"
 38       power_on: "true"
 39       all_eulas_accepted: "true"
 40       storage_profile: "Fast"
 41       network: "{{ vapp_network }}"
 42       cust_script: "resource/win-cust-script.cmd"
 43       deploy: false
 44       state: "present"

then once VM created, in UI I can see next image

so looks like it put script name to script body, if I understand correctly from documentation, I should use script name for cust_script parameter.

cust_script - (Optional) script to run on guest customization
     cust_script: "test_script"

same in python file

[~/ansible-module-vcloud-director/modules]$ sed -n 178p vcd_vapp_vm.py                                                         ✔[master]
    cust_script = "/home/setup.sh"
mukultaneja commented 3 years ago

I looked into this issue and it is reproducible. I checked the code and figured out it is not due to the ansible module but the pyvcloud itself.