nutanix / nutanix.ansible

Official Nutanix Ansible collections
GNU General Public License v3.0
64 stars 36 forks source link

[Imprv] add functionality to provide sysprep or cloud-init to module ntnx_vms via a variable instead of a file #389

Open grdavies opened 1 year ago

grdavies commented 1 year ago

Describe the request Currently the only way to provide customization scripts is via a parameter that takes the file path of the customization script that is to be applied. This approach requires the script to either pre-exist or be generated (via a jinja template for example) and stored as a file before being used by the script. This can cause potentially a buildup of unnecessary scripts on the system that the playbook is being run from. As these scripts ofter contain sensitive information like local administrative passwords etc. this can also pose a security risk.

I would like to provide the customization script to the ntnx_vms module parameter directly from the template instead of first having to save the template as a file.

Current behaviour ntnx_vms: state: present ... guest_customization: type: "cloud_init" script_path: "./cloud_init.yml" is_overridable: True

Expected behaviour ntnx_vms: state: present ... guest_customization: type: "cloud_init" script: "{{ lookup('template', 'sysprep.j2') }}" is_overridable: True

elwood218 commented 12 months ago

+1 That would be awesome! Instead of giving a path to a file it would be better to read userdata from a Ansible template.

bhati-pradeep commented 10 months ago

Review in progress. Moved to 1.9.2